<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Win32API::File - Low-level access to Win32 system API calls for files/dirs. - Perldoc Browser</title>
    <link rel="search" href="https://perldoc.perl.org/opensearch.xml" type="application/opensearchdescription+xml" title="Perldoc Browser">
    <link rel="canonical" href="https://perldoc.perl.org/Win32API::File">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/styles/stackoverflow-light.min.css" integrity="sha512-cG1IdFxqipi3gqLmksLtuk13C+hBa57a6zpWxMeoY3Q9O6ooFxq50DayCdm0QrDgZjMUn23z/0PMZlgft7Yp5Q==" crossorigin="anonymous" />
    <style>
      body {
        background: #f4f4f5;
        color: #020202;
      }
      .navbar-dark {
        background-image: -webkit-linear-gradient(top, #005f85 0, #002e49 100%);
        background-image: -o-linear-gradient(top, #005f85 0, #002e49 100%);
        background-image: linear-gradient(to bottom, #005f85 0, #002e49 100%);
        filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff005f85', endColorstr='#ff002e49', GradientType=0);
        background-repeat: repeat-x;
      }
      .navbar-dark .navbar-nav .nav-link,
      .navbar-dark .navbar-nav .nav-link:focus { color: #fff }
      .navbar-dark .navbar-nav .nav-link:hover { color: #ffef68 }
      #wrapperlicious {
        margin: 0 auto;
        font: 0.9em 'Helvetica Neue', Helvetica, sans-serif;
        font-weight: normal;
        line-height: 1.5em;
        margin: 0;
        padding: 0;
      }
      #wrapperlicious h1 { font-size: 1.5em }
      #wrapperlicious h2 { font-size: 1.3em }
      #wrapperlicious h3 { font-size: 1.1em }
      #wrapperlicious h4 { font-size: 0.9em }
      #wrapperlicious h1, #wrapperlicious h2, #wrapperlicious h3,
      #wrapperlicious h4, #wrapperlicious dt {
        color: #020202;
        margin-top: 1em;
        margin-bottom: 1em;
        position: relative;
        font-weight: bold;
      }
      #wrapperlicious a { color: inherit; text-decoration: underline }
      #wrapperlicious #toc { text-decoration: none }
      #wrapperlicious a:hover { color: #2a2a2a }
      #wrapperlicious a img { border: 0 }
      #wrapperlicious :not(pre) > code {
        color: inherit;
        background-color: rgba(0, 0, 0, 0.04);
        border-radius: 3px;
        font: 0.9em Consolas, Menlo, Monaco, monospace;
        padding: 0.3em;
      }
      #wrapperlicious dd {
        margin: 0;
        margin-left: 2em;
      }
      #wrapperlicious dt {
        color: #2a2a2a;
        font-weight: bold;
        margin-left: 0.9em;
      }
      #wrapperlicious p {
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious li > p {
        margin-bottom: 0;
        margin-top: 0;
      }
      #wrapperlicious pre {
        border: 1px solid #c1c1c1;
        border-radius: 3px;
        font: 100% Consolas, Menlo, Monaco, monospace;
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious pre > code {
        display: block;
        background-color: #f6f6f6;
        font: 0.9em Consolas, Menlo, Monaco, monospace;
        line-height: 1.5em;
        text-align: left;
        white-space: pre;
        padding: 1em;
      }
      #wrapperlicious dl, #wrapperlicious ol, #wrapperlicious ul {
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious ul {
        list-style-type: square;
      }
      #wrapperlicious ul ul {
        margin-bottom: 0px;
        margin-top: 0px;
      }
      #footer {
        font-size: 0.8em;
        padding-top: 0.5em;
        text-align: center;
      }
      #more {
        display: inline;
        font-size: 0.8em;
      }
      #perldocdiv {
        background-color: #fff;
        border: 1px solid #c1c1c1;
        border-bottom-left-radius: 5px;
        border-bottom-right-radius: 5px;
        margin-left: auto;
        margin-right: auto;
        padding: 3em;
        padding-top: 1em;
        max-width: 960px;
      }
      #moduleversion { float: right }
      #wrapperlicious .leading-notice {
        font-style: italic;
        padding-left: 1em;
        margin-top: 1em;
        margin-bottom: 1em;
      }
      #wrapperlicious .permalink {
        display: none;
        left: -0.75em;
        position: absolute;
        padding-right: 0.25em;
        text-decoration: none;
      }
      #wrapperlicious h1:hover .permalink, #wrapperlicious h2:hover .permalink,
      #wrapperlicious h3:hover .permalink, #wrapperlicious h4:hover .permalink,
      #wrapperlicious dt:hover .permalink {
        display: block;
      }
    </style>
    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=G-KVNWBNT5FB"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());

      gtag('config', 'G-KVNWBNT5FB');
      gtag('config', 'UA-50555-3');
    </script>
  </head>
  <body>
    <nav class="navbar navbar-expand-md navbar-dark bg-dark justify-content-between">
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <a class="navbar-brand" href="https://perldoc.perl.org/">Perldoc Browser</a>
  <div class="collapse navbar-collapse" id="navbarNav">
    <ul class="navbar-nav mr-auto">
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./Win32API::File.html#" id="dropdownlink-stable" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">5.35.0</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-stable">
          <a class="dropdown-item" href="https://perldoc.perl.org/Win32API::File">Latest</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.2/Win32API::File">5.38.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.1/Win32API::File">5.38.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0/Win32API::File">5.38.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.3/Win32API::File">5.36.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.2/Win32API::File">5.36.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.1/Win32API::File">5.36.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.0/Win32API::File">5.36.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.3/Win32API::File">5.34.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.2/Win32API::File">5.34.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.1/Win32API::File">5.34.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.0/Win32API::File">5.34.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.32.1/Win32API::File">5.32.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.32.0/Win32API::File">5.32.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.3/Win32API::File">5.30.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.2/Win32API::File">5.30.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.1/Win32API::File">5.30.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.0/Win32API::File">5.30.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.3/Win32API::File">5.28.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.2/Win32API::File">5.28.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.1/Win32API::File">5.28.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.0/Win32API::File">5.28.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.3/Win32API::File">5.26.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.2/Win32API::File">5.26.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.1/Win32API::File">5.26.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.0/Win32API::File">5.26.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.4/Win32API::File">5.24.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.3/Win32API::File">5.24.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.2/Win32API::File">5.24.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.1/Win32API::File">5.24.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.0/Win32API::File">5.24.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.4/Win32API::File">5.22.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.3/Win32API::File">5.22.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.2/Win32API::File">5.22.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.1/Win32API::File">5.22.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.0/Win32API::File">5.22.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.3/Win32API::File">5.20.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.2/Win32API::File">5.20.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.1/Win32API::File">5.20.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.0/Win32API::File">5.20.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.4/Win32API::File">5.18.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.3/Win32API::File">5.18.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.2/Win32API::File">5.18.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.1/Win32API::File">5.18.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.0/Win32API::File">5.18.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.3/Win32API::File">5.16.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.2/Win32API::File">5.16.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.1/Win32API::File">5.16.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.0/Win32API::File">5.16.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.4/Win32API::File">5.14.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.3/Win32API::File">5.14.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.2/Win32API::File">5.14.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.1/Win32API::File">5.14.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.0/Win32API::File">5.14.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.5/Win32API::File">5.12.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.4/Win32API::File">5.12.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.3/Win32API::File">5.12.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.2/Win32API::File">5.12.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.1/Win32API::File">5.12.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.0/Win32API::File">5.12.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.10.1/Win32API::File">5.10.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.10.0/Win32API::File">5.10.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.9/Win32API::File">5.8.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.8/Win32API::File">5.8.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.7/Win32API::File">5.8.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.6/Win32API::File">5.8.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.5/Win32API::File">5.8.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.4/Win32API::File">5.8.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.3/Win32API::File">5.8.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.2/Win32API::File">5.8.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.1/Win32API::File">5.8.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.0/Win32API::File">5.8.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.2/Win32API::File">5.6.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.1/Win32API::File">5.6.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.0/Win32API::File">5.6.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_04/Win32API::File">5.005_04</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_03/Win32API::File">5.005_03</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_02/Win32API::File">5.005_02</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_01/Win32API::File">5.005_01</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005/Win32API::File">5.005</a>
        </div>
      </li>
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./Win32API::File.html#" id="dropdownlink-dev" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dev</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-dev">
          <a class="dropdown-item" href="https://perldoc.perl.org/blead/Win32API::File">blead</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.6/Win32API::File">5.39.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.5/Win32API::File">5.39.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.4/Win32API::File">5.39.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.3/Win32API::File">5.39.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.2/Win32API::File">5.39.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.1/Win32API::File">5.39.1</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0-RC2/Win32API::File">5.38.0-RC2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0-RC1/Win32API::File">5.38.0-RC1</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.11/Win32API::File">5.37.11</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.10/Win32API::File">5.37.10</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.9/Win32API::File">5.37.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.8/Win32API::File">5.37.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.7/Win32API::File">5.37.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.6/Win32API::File">5.37.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.5/Win32API::File">5.37.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.4/Win32API::File">5.37.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.3/Win32API::File">5.37.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.2/Win32API::File">5.37.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.1/Win32API::File">5.37.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.0/Win32API::File">5.37.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.11/Win32API::File">5.35.11</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.10/Win32API::File">5.35.10</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.9/Win32API::File">5.35.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.8/Win32API::File">5.35.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.7/Win32API::File">5.35.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.6/Win32API::File">5.35.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.5/Win32API::File">5.35.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.4/Win32API::File">5.35.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.3/Win32API::File">5.35.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.2/Win32API::File">5.35.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.1/Win32API::File">5.35.1</a>
          <a class="dropdown-item active" href="./Win32API::File.html">5.35.0</a>
        </div>
      </li>
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./Win32API::File.html#" id="dropdownlink-nav" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Documentation</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-nav">
          <a class="dropdown-item" href="perl.html">Perl</a>
          <a class="dropdown-item" href="perlintro.html">Intro</a>
          <a class="dropdown-item" href="perl.html#Tutorials">Tutorials</a>
          <a class="dropdown-item" href="perlfaq.html">FAQs</a>
          <a class="dropdown-item" href="perl.html#Reference-Manual">Reference</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="perlop.html">Operators</a>
          <a class="dropdown-item" href="functions.html">Functions</a>
          <a class="dropdown-item" href="variables.html">Variables</a>
          <a class="dropdown-item" href="modules.html">Modules</a>
          <a class="dropdown-item" href="perlutil.html">Utilities</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="perlcommunity.html">Community</a>
          <a class="dropdown-item" href="perlhist.html">History</a>
        </div>
      </li>
    </ul>
    <ul class="navbar-nav">
      <script>
        function set_expand (expand) {
          var perldocdiv = document.getElementById('perldocdiv');
          var width = window.getComputedStyle(perldocdiv).getPropertyValue('max-width');
          var expanded = (width == '' || width == 'none') ? true : false;
          if (expand === null) {
            expand = !expanded;
          }
          if ((expand && !expanded) || (!expand && expanded)) {
            perldocdiv.style.setProperty('max-width', expand ? 'none' : '960px');
            var button_classlist = document.getElementById('content-expand-button').classList;
            if (expand) {
              button_classlist.add('btn-light');
              button_classlist.remove('btn-outline-light');
            } else {
              button_classlist.add('btn-outline-light');
              button_classlist.remove('btn-light');
            }
          }
          return expand;
        }
        function toggle_expand () {
          var expand = set_expand(null);
          document.cookie = 'perldoc_expand=' + (expand ? 1 : 0) + '; path=/; expires=Tue, 19 Jan 2038 03:14:07 UTC';
        }
        function read_expand () {
          return document.cookie.split(';').some(function (item) { return item.indexOf('perldoc_expand=1') >= 0 });
        }
        if (document.readyState === 'loading') {
          document.addEventListener('DOMContentLoaded', function () {
            if (read_expand()) {
              set_expand(true);
            }
          });
        } else if (read_expand()) {
          set_expand(true);
        }
      </script>
      <button id="content-expand-button" type="button" class="btn btn-outline-light d-none d-lg-inline-block mr-2" onclick="toggle_expand()">Expand</button>
    <ul>
    <form class="form-inline" method="get" action="https://perldoc.perl.org/5.35.0/search">
      <input class="form-control mr-3" type="search" name="q" placeholder="Search" aria-label="Search">
    </form>
  </div>
</nav>

    <div id="wrapperlicious" class="container-fluid">
      <div id="perldocdiv">
        <div id="links">
          <a href="./Win32API::File.html">Win32API::File</a>
          <div id="more">
            (<a href="./Win32API::File.txt">source</a>,
            <a href="https://metacpan.org/pod/Win32API::File">CPAN</a>)
          </div>
            <div id="moduleversion">version 0.1203_01</div>
        </div>
        <div class="leading-notice">
          You are viewing the version of this documentation from Perl 5.35.0.
            This is a development version of Perl.
        </div>
        <h1><a id="toc">CONTENTS</a></h1>
                  <ul>
              <li>
                <a class="text-decoration-none" href="./Win32API::File.html#NAME">NAME</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Win32API::File.html#SYNOPSIS">SYNOPSIS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Win32API::File.html#DESCRIPTION">DESCRIPTION</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./Win32API::File.html#Object-Oriented/Tied-Handle-Interface">Object Oriented/Tied Handle Interface</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Win32API::File.html#Exports">Exports</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./Win32API::File.html#BUGS">BUGS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Win32API::File.html#AUTHOR">AUTHOR</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Win32API::File.html#SEE-ALSO">SEE ALSO</a>
              </li>
          </ul>

      <h1 id="NAME"><a class="permalink" href="./Win32API::File.html#NAME">#</a>NAME</h1>

<p>Win32API::File - Low-level access to Win32 system API calls for files/dirs.</p>

<h1 id="SYNOPSIS"><a class="permalink" href="./Win32API::File.html#SYNOPSIS">#</a>SYNOPSIS</h1>

<pre><code>use Win32API::File 0.08 qw( :ALL );

MoveFile( $Source, $Destination )
  or  die &quot;Can&#39;t move $Source to $Destination: &quot;,fileLastError(),&quot;\n&quot;;
MoveFileEx( $Source, $Destination, MOVEFILE_REPLACE_EXISTING() )
  or  die &quot;Can&#39;t move $Source to $Destination: &quot;,fileLastError(),&quot;\n&quot;;
[...]</code></pre>

<h1 id="DESCRIPTION"><a class="permalink" href="./Win32API::File.html#DESCRIPTION">#</a>DESCRIPTION</h1>

<p>This provides fairly low-level access to the Win32 System API calls dealing with files and directories.</p>

<p>To pass in <code>NULL</code> as the pointer to an optional buffer, pass in an empty list reference, <code>[]</code>.</p>

<p>Beyond raw access to the API calls and related constants, this module handles smart buffer allocation and translation of return codes.</p>

<p>All functions, unless otherwise noted, return a true value for success and a false value for failure and set <code>$^E</code> on failure.</p>

<h2 id="Object-Oriented/Tied-Handle-Interface"><a class="permalink" href="./Win32API::File.html#Object-Oriented/Tied-Handle-Interface">#</a><a id="Object"></a><a id="Object-Oriented-Tied-Handle-Interface"></a>Object Oriented/Tied Handle Interface</h2>

<p>WARNING: this is new code, use at your own risk.</p>

<p>This version of <code>Win32API::File</code> can be used like an <code>IO::File</code> object:</p>

<pre><code>my $file = Win32API::File-&gt;new(&quot;+&gt; foo&quot;);
binmode $file;
print $file &quot;hello there\n&quot;;
seek $file, 0, 0;
my $line = &lt;$file&gt;;
$file-&gt;close;</code></pre>

<p>It also supports tying via a win32 handle (for example, from <code>createFile()</code>):</p>

<pre><code>tie FILE, &#39;Win32API::File&#39;, $win32_handle;
print FILE &quot;...&quot;;</code></pre>

<p>It has not been extensively tested yet and buffered I/O is not yet implemented.</p>

<h2 id="Exports"><a class="permalink" href="./Win32API::File.html#Exports">#</a>Exports</h2>

<p>Nothing is exported by default. The following tags can be used to have large sets of symbols exported: <code>&quot;:Func&quot;</code>, <code>&quot;:FuncA&quot;</code>, <code>&quot;:FuncW&quot;</code>, <code>&quot;:Misc&quot;</code>, <code>&quot;:DDD_&quot;</code>, <code>&quot;:DRIVE_&quot;</code>, <code>&quot;:FILE_&quot;</code>, <code>&quot;:FILE_ATTRIBUTE_&quot;</code>, <code>&quot;:FILE_FLAG_&quot;</code>, <code>&quot;:FILE_SHARE_&quot;</code>, <code>&quot;:FILE_TYPE_&quot;</code>, <code>&quot;:FS_&quot;</code>, <code>&quot;:FSCTL_&quot;</code>, <code>&quot;:HANDLE_FLAG_&quot;</code>, <code>&quot;:IOCTL_STORAGE_&quot;</code>, <code>&quot;:IOCTL_DISK_&quot;</code>, <code>&quot;:GENERIC_&quot;</code>, <code>&quot;:MEDIA_TYPE&quot;</code>, <code>&quot;:MOVEFILE_&quot;</code>, <code>&quot;:SECURITY_&quot;</code>, <code>&quot;:SEM_&quot;</code>, and <code>&quot;:PARTITION_&quot;</code>.</p>

<dl>

<dt id="&quot;:Func&quot;"><a class="permalink" href="./Win32API::File.html#%22:Func%22">#</a><a id="Func"></a><code>&quot;:Func&quot;</code></dt>
<dd>

<p>The basic function names: <code>attrLetsToBits</code>, <code>createFile</code>, <code>fileConstant</code>, <code>fileLastError</code>, <code>getLogicalDrives</code>, <code>setFilePointer</code>, <code>getFileSize</code>, <code>CloseHandle</code>, <code>CopyFile</code>, <code>CreateFile</code>, <code>DefineDosDevice</code>, <code>DeleteFile</code>, <code>DeviceIoControl</code>, <code>FdGetOsFHandle</code>, <code>GetDriveType</code>, <code>GetFileAttributes</code>, <code>GetFileSize</code>, <code>GetFileType</code>, <code>GetHandleInformation</code>, <code>GetLogicalDrives</code>, <code>GetLogicalDriveStrings</code>, <code>GetOsFHandle</code>, <code>GetOverlappedResult</code>, <code>GetVolumeInformation</code>, <code>IsContainerPartition</code>, <code>IsRecognizedPartition</code>, <code>MoveFile</code>, <code>MoveFileEx</code>, <code>OsFHandleOpen</code>, <code>OsFHandleOpenFd</code>, <code>QueryDosDevice</code>, <code>ReadFile</code>, <code>SetErrorMode</code>, <code>SetFilePointer</code>, <code>SetHandleInformation</code>, and <code>WriteFile</code>.</p>

<dl>

<dt id="attrLetsToBits"><a class="permalink" href="./Win32API::File.html#attrLetsToBits">#</a>attrLetsToBits</dt>
<dd>

</dd>
<dt id="$uBits=-attrLetsToBits(-$sAttributeLetters-)"><a class="permalink" href="./Win32API::File.html#$uBits=-attrLetsToBits(-$sAttributeLetters-)">#</a><a id="uBits-attrLetsToBits-sAttributeLetters"></a><code>$uBits= attrLetsToBits( $sAttributeLetters )</code></dt>
<dd>

<p>Converts a string of file attribute letters into an unsigned value with the corresponding bits set. <code>$sAttributeLetters</code> should contain zero or more letters from <code>&quot;achorst&quot;</code>:</p>

<dl>

<dt id="&quot;a&quot;"><a class="permalink" href="./Win32API::File.html#%22a%22">#</a><a id="a"></a><code>&quot;a&quot;</code></dt>
<dd>

<p><code>FILE_ATTRIBUTE_ARCHIVE</code></p>

</dd>
<dt id="&quot;c&quot;"><a class="permalink" href="./Win32API::File.html#%22c%22">#</a><a id="c"></a><code>&quot;c&quot;</code></dt>
<dd>

<p><code>FILE_ATTRIBUTE_COMPRESSED</code></p>

</dd>
<dt id="&quot;h&quot;"><a class="permalink" href="./Win32API::File.html#%22h%22">#</a><a id="h"></a><code>&quot;h&quot;</code></dt>
<dd>

<p><code>FILE_ATTRIBUTE_HIDDEN</code></p>

</dd>
<dt id="&quot;o&quot;"><a class="permalink" href="./Win32API::File.html#%22o%22">#</a><a id="o"></a><code>&quot;o&quot;</code></dt>
<dd>

<p><code>FILE_ATTRIBUTE_OFFLINE</code></p>

</dd>
<dt id="&quot;r&quot;"><a class="permalink" href="./Win32API::File.html#%22r%22">#</a><a id="r"></a><code>&quot;r&quot;</code></dt>
<dd>

<p><code>FILE_ATTRIBUTE_READONLY</code></p>

</dd>
<dt id="&quot;s&quot;"><a class="permalink" href="./Win32API::File.html#%22s%22">#</a><a id="s"></a><code>&quot;s&quot;</code></dt>
<dd>

<p><code>FILE_ATTRIBUTE_SYSTEM</code></p>

</dd>
<dt id="&quot;t&quot;"><a class="permalink" href="./Win32API::File.html#%22t%22">#</a><a id="t"></a><code>&quot;t&quot;</code></dt>
<dd>

<p><code>FILE_ATTRIBUTE_TEMPORARY</code></p>

</dd>
</dl>

</dd>
<dt id="createFile"><a class="permalink" href="./Win32API::File.html#createFile">#</a>createFile</dt>
<dd>

</dd>
<dt id="$hObject=-createFile(-$sPath-)"><a class="permalink" href="./Win32API::File.html#$hObject=-createFile(-$sPath-)">#</a><a id="hObject-createFile-sPath"></a><code>$hObject= createFile( $sPath )</code></dt>
<dd>

</dd>
<dt id="$hObject=-createFile(-$sPath,-$rvhvOptions-)"><a class="permalink" href="./Win32API::File.html#$hObject=-createFile(-$sPath,-$rvhvOptions-)">#</a><a id="hObject-createFile-sPath-rvhvOptions"></a><code>$hObject= createFile( $sPath, $rvhvOptions )</code></dt>
<dd>

</dd>
<dt id="$hObject=-createFile(-$sPath,-$svAccess-)"><a class="permalink" href="./Win32API::File.html#$hObject=-createFile(-$sPath,-$svAccess-)">#</a><a id="hObject-createFile-sPath-svAccess"></a><code>$hObject= createFile( $sPath, $svAccess )</code></dt>
<dd>

</dd>
<dt id="$hObject=-createFile(-$sPath,-$svAccess,-$rvhvOptions-)"><a class="permalink" href="./Win32API::File.html#$hObject=-createFile(-$sPath,-$svAccess,-$rvhvOptions-)">#</a><a id="hObject-createFile-sPath-svAccess-rvhvOptions"></a><code>$hObject= createFile( $sPath, $svAccess, $rvhvOptions )</code></dt>
<dd>

</dd>
<dt id="$hObject=-createFile(-$sPath,-$svAccess,-$svShare-)"><a class="permalink" href="./Win32API::File.html#$hObject=-createFile(-$sPath,-$svAccess,-$svShare-)">#</a><a id="hObject-createFile-sPath-svAccess-svShare"></a><code>$hObject= createFile( $sPath, $svAccess, $svShare )</code></dt>
<dd>

</dd>
<dt id="$hObject=-createFile(-$sPath,-$svAccess,-$svShare,-$rvhvOptions-)"><a class="permalink" href="./Win32API::File.html#$hObject=-createFile(-$sPath,-$svAccess,-$svShare,-$rvhvOptions-)">#</a><a id="hObject-createFile-sPath-svAccess-svShare-rvhvOptions"></a><code>$hObject= createFile( $sPath, $svAccess, $svShare, $rvhvOptions )</code></dt>
<dd>

<p>This is a Perl-friendly wrapper around <code>CreateFile</code>.</p>

<p>On failure, <code>$hObject</code> gets set to a false value and <code>regLastError()</code> and <code>$^E</code> are set to the reason for the failure. Otherwise, <code>$hObject</code> gets set to a Win32 native file handle which is always a true value [returns <code>&quot;0 but true&quot;</code> in the impossible(?) case of the handle having a value of <code>0</code>].</p>

<p><code>$sPath</code> is the path to the file [or device, etc.] to be opened. See <code>CreateFile</code> for more information on possible special values for <code>$sPath</code>.</p>

<p><code>$svAccess</code> can be a number containing the bit mask representing the specific type(s) of access to the file that you desire. See the <code>$uAccess</code> parameter to <code>CreateFile</code> for more information on these values.</p>

<p>More likely, <code>$svAccess</code> is a string describing the generic type of access you desire and possibly the file creation options to use. In this case, <code>$svAccess</code> should contain zero or more characters from <code>&quot;qrw&quot;</code> [access desired], zero or one character each from <code>&quot;ktn&quot;</code> and <code>&quot;ce&quot;</code>, and optional white space. These letters stand for, respectively, &quot;Query access&quot;, &quot;Read access&quot;, &quot;Write access&quot;, &quot;Keep if exists&quot;, &quot;Truncate if exists&quot;, &quot;New file only&quot;, &quot;Create if none&quot;, and &quot;Existing file only&quot;. Case is ignored.</p>

<p>You can pass in <code>&quot;?&quot;</code> for <code>$svAccess</code> to have an error message displayed summarizing its possible values. This is very handy when doing on-the-fly programming using the Perl debugger:</p>

<pre><code>    Win32API::File::createFile:  $svAccess can use the following:
	One or more of the following:
	    q -- Query access (same as 0)
	    r -- Read access (GENERIC_READ)
	    w -- Write access (GENERIC_WRITE)
	At most one of the following:
	    k -- Keep if exists
	    t -- Truncate if exists
	    n -- New file only (fail if file already exists)
	At most one of the following:
	    c -- Create if doesn&#39;t exist
	    e -- Existing file only (fail if doesn&#39;t exist)
      &#39;&#39;   is the same as &#39;q  k e&#39;
      &#39;r&#39;  is the same as &#39;r  k e&#39;
      &#39;w&#39;  is the same as &#39;w  t c&#39;
      &#39;rw&#39; is the same as &#39;rw k c&#39;
      &#39;rt&#39; or &#39;rn&#39; implies &#39;c&#39;.
      Or $access can be numeric.</code></pre>

<p><code>$svAccess</code> is designed to be &quot;do what I mean&quot;, so you can skip the rest of its explanation unless you are interested in the complex details. Note that, if you want write access to a device, you need to specify <code>&quot;k&quot;</code> [and perhaps <code>&quot;e&quot;</code>, as in <code>&quot;w ke&quot;</code> or <code>&quot;rw ke&quot;</code>] since Win32 suggests <code>OPEN_EXISTING</code> be used when opening a device.</p>

<dl>

<dt id="&quot;q&quot;"><a class="permalink" href="./Win32API::File.html#%22q%22">#</a><a id="q"></a><code>&quot;q&quot;</code></dt>
<dd>

<p>Stands for &quot;Query access&quot;. This is really a no-op since you always have query access when you open a file. You can specify <code>&quot;q&quot;</code> to document that you plan to query the file [or device, etc.]. This is especially helpful when you don&#39;t want read nor write access since something like <code>&quot;q&quot;</code> or <code>&quot;q ke&quot;</code> may be easier to understand than just <code>&quot;&quot;</code> or <code>&quot;ke&quot;</code>.</p>

</dd>
<dt id="&quot;r&quot;1"><a class="permalink" href="./Win32API::File.html#%22r%221">#</a><a id="r1"></a><code>&quot;r&quot;</code></dt>
<dd>

<p>Stands for &quot;Read access&quot;. Sets the <code>GENERIC_READ</code> bit(s) in the <code>$uAccess</code> that is passed to <code>CreateFile</code>. This is the default access if the <code>$svAccess</code> parameter is missing [or if it is <code>undef</code> and <code>$rvhvOptions</code> doesn&#39;t specify an <code>&quot;Access&quot;</code> option].</p>

</dd>
<dt id="&quot;w&quot;"><a class="permalink" href="./Win32API::File.html#%22w%22">#</a><a id="w"></a><code>&quot;w&quot;</code></dt>
<dd>

<p>Stands for &quot;Write access&quot;. Sets the <code>GENERIC_WRITE</code> bit(s) in the <code>$uAccess</code> that is passed to <code>CreateFile</code>.</p>

</dd>
<dt id="&quot;k&quot;"><a class="permalink" href="./Win32API::File.html#%22k%22">#</a><a id="k"></a><code>&quot;k&quot;</code></dt>
<dd>

<p>Stands for &quot;Keep if exists&quot;. If the requested file exists, then it is opened. This is the default unless <code>GENERIC_WRITE</code> access has been requested but <code>GENERIC_READ</code> access has not been requested. Contrast with <code>&quot;t&quot;</code> and <code>&quot;n&quot;</code>.</p>

</dd>
<dt id="&quot;t&quot;1"><a class="permalink" href="./Win32API::File.html#%22t%221">#</a><a id="t1"></a><code>&quot;t&quot;</code></dt>
<dd>

<p>Stands for &quot;Truncate if exists&quot;. If the requested file exists, then it is truncated to zero length and then opened. This is the default if <code>GENERIC_WRITE</code> access has been requested and <code>GENERIC_READ</code> access has not been requested. Contrast with <code>&quot;k&quot;</code> and <code>&quot;n&quot;</code>.</p>

</dd>
<dt id="&quot;n&quot;"><a class="permalink" href="./Win32API::File.html#%22n%22">#</a><a id="n"></a><code>&quot;n&quot;</code></dt>
<dd>

<p>Stands for &quot;New file only&quot;. If the requested file exists, then it is not opened and the <code>createFile</code> call fails. Contrast with <code>&quot;k&quot;</code> and <code>&quot;t&quot;</code>. Can&#39;t be used with <code>&quot;e&quot;</code>.</p>

</dd>
<dt id="&quot;c&quot;1"><a class="permalink" href="./Win32API::File.html#%22c%221">#</a><a id="c1"></a><code>&quot;c&quot;</code></dt>
<dd>

<p>Stands for &quot;Create if none&quot;. If the requested file does not exist, then it is created and then opened. This is the default if <code>GENERIC_WRITE</code> access has been requested or if <code>&quot;t&quot;</code> or <code>&quot;n&quot;</code> was specified. Contrast with <code>&quot;e&quot;</code>.</p>

</dd>
<dt id="&quot;e&quot;"><a class="permalink" href="./Win32API::File.html#%22e%22">#</a><a id="e"></a><code>&quot;e&quot;</code></dt>
<dd>

<p>Stands for &quot;Existing file only&quot;. If the requested file does not exist, then nothing is opened and the <code>createFile</code> call fails. This is the default unless <code>GENERIC_WRITE</code> access has been requested or <code>&quot;t&quot;</code> or <code>&quot;n&quot;</code> was specified. Contrast with <code>&quot;c&quot;</code>. Can&#39;t be used with <code>&quot;n&quot;</code>.</p>

</dd>
</dl>

<p>The characters from <code>&quot;ktn&quot;</code> and <code>&quot;ce&quot;</code> are combined to determine the what value for <code>$uCreate</code> to pass to <code>CreateFile</code> [unless overridden by <code>$rvhvOptions</code>]:</p>

<dl>

<dt id="&quot;kc&quot;"><a class="permalink" href="./Win32API::File.html#%22kc%22">#</a><a id="kc"></a><code>&quot;kc&quot;</code></dt>
<dd>

<p><code>OPEN_ALWAYS</code></p>

</dd>
<dt id="&quot;ke&quot;"><a class="permalink" href="./Win32API::File.html#%22ke%22">#</a><a id="ke"></a><code>&quot;ke&quot;</code></dt>
<dd>

<p><code>OPEN_EXISTING</code></p>

</dd>
<dt id="&quot;tc&quot;"><a class="permalink" href="./Win32API::File.html#%22tc%22">#</a><a id="tc"></a><code>&quot;tc&quot;</code></dt>
<dd>

<p><code>TRUNCATE_EXISTING</code></p>

</dd>
<dt id="&quot;te&quot;"><a class="permalink" href="./Win32API::File.html#%22te%22">#</a><a id="te"></a><code>&quot;te&quot;</code></dt>
<dd>

<p><code>CREATE_ALWAYS</code></p>

</dd>
<dt id="&quot;nc&quot;"><a class="permalink" href="./Win32API::File.html#%22nc%22">#</a><a id="nc"></a><code>&quot;nc&quot;</code></dt>
<dd>

<p><code>CREATE_NEW</code></p>

</dd>
<dt id="&quot;ne&quot;"><a class="permalink" href="./Win32API::File.html#%22ne%22">#</a><a id="ne"></a><code>&quot;ne&quot;</code></dt>
<dd>

<p>Illegal.</p>

</dd>
</dl>

<p><code>$svShare</code> controls how the file is shared, that is, whether other processes can have read, write, and/or delete access to the file while we have it opened. <code>$svShare</code> will usually be a string containing zero or more characters from <code>&quot;rwd&quot;</code> but can also be a numeric bit mask.</p>

<p><code>&quot;r&quot;</code> sets the <code>FILE_SHARE_READ</code> bit which allows other processes to have read access to the file. <code>&quot;w&quot;</code> sets the <code>FILE_SHARE_WRITE</code> bit which allows other processes to have write access to the file. <code>&quot;d&quot;</code> sets the <code>FILE_SHARE_DELETE</code> bit which allows other processes to have delete access to the file [ignored under Windows 95].</p>

<p>The default for <code>$svShare</code> is <code>&quot;rw&quot;</code> which provides the same sharing as using regular perl <code>open()</code>.</p>

<p>If another process currently has read, write, and/or delete access to the file and you don&#39;t allow that level of sharing, then your call to <code>createFile</code> will fail. If you requested read, write, and/or delete access and another process already has the file open but doesn&#39;t allow that level of sharing, then your call to <code>createFile</code> will fail. Once you have the file open, if another process tries to open it with read, write, and/or delete access and you don&#39;t allow that level of sharing, then that process won&#39;t be allowed to open the file.</p>

<p><code>$rvhvOptions</code> is a reference to a hash where any keys must be from the list <code>qw( Access Create Share Attributes Flags Security Model )</code>. The meaning of the value depends on the key name, as described below. Any option values in <code>$rvhvOptions</code> override the settings from <code>$svAccess</code> and <code>$svShare</code> if they conflict.</p>

<dl>

<dt id="Flags-=&gt;-$uFlags"><a class="permalink" href="./Win32API::File.html#Flags-=%3E-$uFlags">#</a><a id="Flags"></a><a id="Flags-uFlags"></a>Flags =&gt; $uFlags</dt>
<dd>

<p><code>$uFlags</code> is an unsigned value having any of the <code>FILE_FLAG_*</code> or <code>FILE_ATTRIBUTE_*</code> bits set. Any <code>FILE_ATTRIBUTE_*</code> bits set via the <code>Attributes</code> option are logically <code>or</code>ed with these bits. Defaults to <code>0</code>.</p>

<p>If opening the client side of a named pipe, then you can also specify <code>SECURITY_SQOS_PRESENT</code> along with one of the other <code>SECURITY_*</code> constants to specify the security quality of service to be used.</p>

</dd>
<dt id="Attributes-=&gt;-$sAttributes"><a class="permalink" href="./Win32API::File.html#Attributes-=%3E-$sAttributes">#</a><a id="Attributes"></a><a id="Attributes-sAttributes"></a>Attributes =&gt; $sAttributes</dt>
<dd>

<p>A string of zero or more characters from <code>&quot;achorst&quot;</code> [see <code>attrLetsToBits</code> for more information] which are converted to <code>FILE_ATTRIBUTE_*</code> bits to be set in the <code>$uFlags</code> argument passed to <code>CreateFile</code>.</p>

</dd>
<dt id="Security-=&gt;-$pSecurityAttributes"><a class="permalink" href="./Win32API::File.html#Security-=%3E-$pSecurityAttributes">#</a><a id="Security"></a><a id="Security-pSecurityAttributes"></a>Security =&gt; $pSecurityAttributes</dt>
<dd>

<p><code>$pSecurityAttributes</code> should contain a <code>SECURITY_ATTRIBUTES</code> structure packed into a string or <code>[]</code> [the default].</p>

</dd>
<dt id="Model-=&gt;-$hModelFile"><a class="permalink" href="./Win32API::File.html#Model-=%3E-$hModelFile">#</a><a id="Model"></a><a id="Model-hModelFile"></a>Model =&gt; $hModelFile</dt>
<dd>

<p><code>$hModelFile</code> should contain a handle opened with <code>GENERIC_READ</code> access to a model file from which file attributes and extended attributes are to be copied. Or <code>$hModelFile</code> can be <code>0</code> [the default].</p>

</dd>
<dt id="Access-=&gt;-$sAccess"><a class="permalink" href="./Win32API::File.html#Access-=%3E-$sAccess">#</a><a id="Access"></a><a id="Access-sAccess"></a>Access =&gt; $sAccess</dt>
<dd>

</dd>
<dt id="Access-=&gt;-$uAccess"><a class="permalink" href="./Win32API::File.html#Access-=%3E-$uAccess">#</a><a id="Access1"></a><a id="Access-uAccess"></a>Access =&gt; $uAccess</dt>
<dd>

<p><code>$sAccess</code> should be a string of zero or more characters from <code>&quot;qrw&quot;</code> specifying the type of access desired: &quot;query&quot; or <code>0</code>, &quot;read&quot; or <code>GENERIC_READ</code> [the default], or &quot;write&quot; or <code>GENERIC_WRITE</code>.</p>

<p><code>$uAccess</code> should be an unsigned value containing bits set to indicate the type of access desired. <code>GENERIC_READ</code> is the default.</p>

</dd>
<dt id="Create-=&gt;-$sCreate"><a class="permalink" href="./Win32API::File.html#Create-=%3E-$sCreate">#</a><a id="Create"></a><a id="Create-sCreate"></a>Create =&gt; $sCreate</dt>
<dd>

</dd>
<dt id="Create-=&gt;-$uCreate"><a class="permalink" href="./Win32API::File.html#Create-=%3E-$uCreate">#</a><a id="Create1"></a><a id="Create-uCreate"></a>Create =&gt; $uCreate</dt>
<dd>

<p><code>$sCreate</code> should be a string containing zero or one character from <code>&quot;ktn&quot;</code> and zero or one character from <code>&quot;ce&quot;</code>. These stand for &quot;Keep if exists&quot;, &quot;Truncate if exists&quot;, &quot;New file only&quot;, &quot;Create if none&quot;, and &quot;Existing file only&quot;. These are translated into a <code>$uCreate</code> value.</p>

<p><code>$uCreate</code> should be one of <code>OPEN_ALWAYS</code>, <code>OPEN_EXISTING</code>, <code>TRUNCATE_EXISTING</code>, <code>CREATE_ALWAYS</code>, or <code>CREATE_NEW</code>.</p>

</dd>
<dt id="Share-=&gt;-$sShare"><a class="permalink" href="./Win32API::File.html#Share-=%3E-$sShare">#</a><a id="Share"></a><a id="Share-sShare"></a>Share =&gt; $sShare</dt>
<dd>

</dd>
<dt id="Share-=&gt;-$uShare"><a class="permalink" href="./Win32API::File.html#Share-=%3E-$uShare">#</a><a id="Share1"></a><a id="Share-uShare"></a>Share =&gt; $uShare</dt>
<dd>

<p><code>$sShare</code> should be a string with zero or more characters from <code>&quot;rwd&quot;</code> that is translated into a <code>$uShare</code> value. <code>&quot;rw&quot;</code> is the default.</p>

<p><code>$uShare</code> should be an unsigned value having zero or more of the following bits set: <code>FILE_SHARE_READ</code>, <code>FILE_SHARE_WRITE</code>, and <code>FILE_SHARE_DELETE</code>. <code>FILE_SHARE_READ|FILE_SHARE_WRITE</code> is the default.</p>

</dd>
</dl>

<p>Examples:</p>

<pre><code>$hFlop= createFile( &quot;//./A:&quot;, &quot;r&quot;, &quot;r&quot; )
  or  die &quot;Can&#39;t prevent others from writing to floppy: $^E\n&quot;;
$hDisk= createFile( &quot;//./C:&quot;, &quot;rw ke&quot;, &quot;&quot; )
  or  die &quot;Can&#39;t get exclusive access to C: $^E\n&quot;;
$hDisk= createFile( $sFilePath, &quot;ke&quot;,
  { Access=&gt;FILE_READ_ATTRIBUTES } )
  or  die &quot;Can&#39;t read attributes of $sFilePath: $^E\n&quot;;
$hTemp= createFile( &quot;$ENV{Temp}/temp.$$&quot;, &quot;wn&quot;, &quot;&quot;,
  { Attributes=&gt;&quot;hst&quot;, Flags=&gt;FILE_FLAG_DELETE_ON_CLOSE() } )
  or  die &quot;Can&#39;t create temporary file, temp.$$: $^E\n&quot;;</code></pre>

</dd>
<dt id="getLogicalDrives"><a class="permalink" href="./Win32API::File.html#getLogicalDrives">#</a>getLogicalDrives</dt>
<dd>

</dd>
<dt id="@roots=-getLogicalDrives()"><a class="permalink" href="./Win32API::File.html#@roots=-getLogicalDrives()">#</a><a id="roots-getLogicalDrives"></a><code>@roots= getLogicalDrives()</code></dt>
<dd>

<p>Returns the paths to the root directories of all logical drives currently defined. This includes all types of drive letters, such as floppies, CD-ROMs, hard disks, and network shares. A typical return value on a poorly equipped computer would be <code>(&quot;A:\\&quot;,&quot;C:\\&quot;)</code>.</p>

</dd>
<dt id="CloseHandle"><a class="permalink" href="./Win32API::File.html#CloseHandle">#</a>CloseHandle</dt>
<dd>

</dd>
<dt id="CloseHandle(-$hObject-)"><a class="permalink" href="./Win32API::File.html#CloseHandle(-$hObject-)">#</a><a id="CloseHandle1"></a><a id="CloseHandle-hObject"></a><code>CloseHandle( $hObject )</code></dt>
<dd>

<p>Closes a Win32 native handle, such as one opened via <code>CreateFile</code>. Like most routines, returns a true value if successful and a false value [and sets <code>$^E</code> and <code>regLastError()</code>] on failure.</p>

</dd>
<dt id="CopyFile"><a class="permalink" href="./Win32API::File.html#CopyFile">#</a>CopyFile</dt>
<dd>

</dd>
<dt id="CopyFile(-$sOldFileName,-$sNewFileName,-$bFailIfExists-)"><a class="permalink" href="./Win32API::File.html#CopyFile(-$sOldFileName,-$sNewFileName,-$bFailIfExists-)">#</a><a id="CopyFile1"></a><a id="CopyFile-sOldFileName-sNewFileName-bFailIfExists"></a><code>CopyFile( $sOldFileName, $sNewFileName, $bFailIfExists )</code></dt>
<dd>

<p><code>$sOldFileName</code> is the path to the file to be copied. <code>$sNewFileName</code> is the path to where the file should be copied. Note that you can <b>NOT</b> just specify a path to a directory in <code>$sNewFileName</code> to copy the file to that directory using the same file name.</p>

<p>If <code>$bFailIfExists</code> is true and <code>$sNewFileName</code> is the path to a file that already exists, then <code>CopyFile</code> will fail. If <code>$bFailIfExists</code> is false, then the copy of the <code>$sOldFileNmae</code> file will overwrite the <code>$sNewFileName</code> file if it already exists.</p>

<p>Like most routines, returns a true value if successful and a false value [and sets <code>$^E</code> and <code>regLastError()</code>] on failure.</p>

</dd>
<dt id="CreateFile"><a class="permalink" href="./Win32API::File.html#CreateFile">#</a>CreateFile</dt>
<dd>

</dd>
<dt id="$hObject=-CreateFile(-$sPath,-$uAccess,-$uShare,-$pSecAttr,-$uCreate,-$uFlags,-$hModel-)"><a class="permalink" href="./Win32API::File.html#$hObject=-CreateFile(-$sPath,-$uAccess,-$uShare,-$pSecAttr,-$uCreate,-$uFlags,-$hModel-)">#</a><a id="hObject-CreateFile-sPath-uAccess-uShare-pSecAttr-uCreate-uFlags-hModel"></a><code>$hObject= CreateFile( $sPath, $uAccess, $uShare, $pSecAttr, $uCreate, $uFlags, $hModel )</code></dt>
<dd>

<p>On failure, <code>$hObject</code> gets set to a false value and <code>$^E</code> and <code>fileLastError()</code> are set to the reason for the failure. Otherwise, <code>$hObject</code> gets set to a Win32 native file handle which is always a true value [returns <code>&quot;0 but true&quot;</code> in the impossible(?) case of the handle having a value of <code>0</code>].</p>

<p><code>$sPath</code> is the path to the file [or device, etc.] to be opened.</p>

<p><code>$sPath</code> can use <code>&quot;/&quot;</code> or <code>&quot;\\&quot;</code> as path delimiters and can even mix the two. We will usually only use <code>&quot;/&quot;</code> in our examples since using <code>&quot;\\&quot;</code> is usually harder to read.</p>

<p>Under Windows NT, <code>$sPath</code> can start with <code>&quot;//?/&quot;</code> to allow the use of paths longer than <code>MAX_PATH</code> [for UNC paths, replace the leading <code>&quot;//&quot;</code> with <code>&quot;//?/UNC/&quot;</code>, as in <code>&quot;//?/UNC/Server/Share/Dir/File.Ext&quot;</code>].</p>

<p><code>$sPath</code> can start with <code>&quot;//./&quot;</code> to indicate that the rest of the path is the name of a &quot;DOS device.&quot; You can use <code>QueryDosDevice</code> to list all current DOS devices and can add or delete them with <code>DefineDosDevice</code>. If you get the source-code distribution of this module from CPAN, then it includes an example script, <i>ex/ListDevs.plx</i> that will list all current DOS devices and their &quot;native&quot; definition. Again, note that this doesn&#39;t work under Win95 nor Win98.</p>

<p>The most common such DOS devices include:</p>

<dl>

<dt id="&quot;//./PhysicalDrive0&quot;"><a class="permalink" href="./Win32API::File.html#%22//./PhysicalDrive0%22">#</a><a id="PhysicalDrive0"></a><code>&quot;//./PhysicalDrive0&quot;</code></dt>
<dd>

<p>Your entire first hard disk. Doesn&#39;t work under Windows 95. This allows you to read or write raw sectors of your hard disk and to use <code>DeviceIoControl</code> to perform miscellaneous queries and operations to the hard disk. Writing raw sectors and certain other operations can seriously damage your files or the function of your computer.</p>

<p>Locking this for exclusive access [by specifying <code>0</code> for <code>$uShare</code>] doesn&#39;t prevent access to the partitions on the disk nor their file systems. So other processes can still access any raw sectors within a partition and can use the file system on the disk as usual.</p>

</dd>
<dt id="&quot;//./C:&quot;"><a class="permalink" href="./Win32API::File.html#%22//./C:%22">#</a><a id="C"></a><code>&quot;//./C:&quot;</code></dt>
<dd>

<p>Your <i>C:</i> partition. Doesn&#39;t work under Windows 95. This allows you to read or write raw sectors of that partition and to use <code>DeviceIoControl</code> to perform miscellaneous queries and operations to the partition. Writing raw sectors and certain other operations can seriously damage your files or the function of your computer.</p>

<p>Locking this for exclusive access doesn&#39;t prevent access to the physical drive that the partition is on so other processes can still access the raw sectors that way. Locking this for exclusive access <b>does</b> prevent other processes from opening the same raw partition and <b>does</b> prevent access to the file system on it. It even prevents the current process from accessing the file system on that partition.</p>

</dd>
<dt id="&quot;//./A:&quot;"><a class="permalink" href="./Win32API::File.html#%22//./A:%22">#</a><a id="A"></a><code>&quot;//./A:&quot;</code></dt>
<dd>

<p>The raw floppy disk. Doesn&#39;t work under Windows 95. This allows you to read or write raw sectors of the floppy disk and to use <code>DeviceIoControl</code> to perform miscellaneous queries and operations to the floppy disk or drive.</p>

<p>Locking this for exclusive access prevents all access to the floppy.</p>

</dd>
<dt id="&quot;//./PIPE/PipeName&quot;"><a class="permalink" href="./Win32API::File.html#%22//./PIPE/PipeName%22">#</a><a id="PIPE-PipeName"></a><code>&quot;//./PIPE/PipeName&quot;</code></dt>
<dd>

<p>A named pipe, created via <code>CreateNamedPipe</code>.</p>

</dd>
</dl>

<p><code>$uAccess</code> is an unsigned value with bits set indicating the type of access desired. Usually either <code>0</code> [&quot;query&quot; access], <code>GENERIC_READ</code>, <code>GENERIC_WRITE</code>, <code>GENERIC_READ|GENERIC_WRITE</code>, or <code>GENERIC_ALL</code>. More specific types of access can be specified, such as <code>FILE_APPEND_DATA</code> or <code>FILE_READ_EA</code>.</p>

<p><code>$uShare</code> controls how the file is shared, that is, whether other processes can have read, write, and/or delete access to the file while we have it opened. <code>$uShare</code> is an unsigned value with zero or more of these bits set: <code>FILE_SHARE_READ</code>, <code>FILE_SHARE_WRITE</code>, and <code>FILE_SHARE_DELETE</code>.</p>

<p>If another process currently has read, write, and/or delete access to the file and you don&#39;t allow that level of sharing, then your call to <code>CreateFile</code> will fail. If you requested read, write, and/or delete access and another process already has the file open but doesn&#39;t allow that level of sharing, then your call to <code>createFile</code> will fail. Once you have the file open, if another process tries to open it with read, write, and/or delete access and you don&#39;t allow that level of sharing, then that process won&#39;t be allowed to open the file.</p>

<p><code>$pSecAttr</code> should either be <code>[]</code> [for <code>NULL</code>] or a <code>SECURITY_ATTRIBUTES</code> data structure packed into a string. For example, if <code>$pSecDesc</code> contains a <code>SECURITY_DESCRIPTOR</code> structure packed into a string, perhaps via:</p>

<pre><code>RegGetKeySecurity( $key, 4, $pSecDesc, 1024 );</code></pre>

<p>then you can set <code>$pSecAttr</code> via:</p>

<pre><code>$pSecAttr= pack( &quot;L P i&quot;, 12, $pSecDesc, $bInheritHandle );</code></pre>

<p><code>$uCreate</code> is one of the following values: <code>OPEN_ALWAYS</code>, <code>OPEN_EXISTING</code>, <code>TRUNCATE_EXISTING</code>, <code>CREATE_ALWAYS</code>, and <code>CREATE_NEW</code>.</p>

<p><code>$uFlags</code> is an unsigned value with zero or more bits set indicating attributes to associate with the file [<code>FILE_ATTRIBUTE_*</code> values] or special options [<code>FILE_FLAG_*</code> values].</p>

<p>If opening the client side of a named pipe, then you can also set <code>$uFlags</code> to include <code>SECURITY_SQOS_PRESENT</code> along with one of the other <code>SECURITY_*</code> constants to specify the security quality of service to be used.</p>

<p><code>$hModel</code> is <code>0</code> [or <code>[]</code>, both of which mean <code>NULL</code>] or a Win32 native handle opened with <code>GENERIC_READ</code> access to a model file from which file attributes and extended attributes are to be copied if a new file gets created.</p>

<p>Examples:</p>

<pre><code>$hFlop= CreateFile( &quot;//./A:&quot;, GENERIC_READ(),
  FILE_SHARE_READ(), [], OPEN_EXISTING(), 0, [] )
  or  die &quot;Can&#39;t prevent others from writing to floppy: $^E\n&quot;;
$hDisk= CreateFile( $sFilePath, FILE_READ_ATTRIBUTES(),
  FILE_SHARE_READ()|FILE_SHARE_WRITE(), [], OPEN_EXISTING(), 0, [] )
  or  die &quot;Can&#39;t read attributes of $sFilePath: $^E\n&quot;;
$hTemp= CreateFile( &quot;$ENV{Temp}/temp.$$&quot;, GENERIC_WRITE(), 0,
  CREATE_NEW(), FILE_FLAG_DELETE_ON_CLOSE()|attrLetsToBits(&quot;hst&quot;), [] )
  or  die &quot;Can&#39;t create temporary file, temp.$$: $^E\n&quot;;</code></pre>

</dd>
<dt id="DefineDosDevice"><a class="permalink" href="./Win32API::File.html#DefineDosDevice">#</a>DefineDosDevice</dt>
<dd>

</dd>
<dt id="DefineDosDevice(-$uFlags,-$sDosDeviceName,-$sTargetPath-)"><a class="permalink" href="./Win32API::File.html#DefineDosDevice(-$uFlags,-$sDosDeviceName,-$sTargetPath-)">#</a><a id="DefineDosDevice1"></a><a id="DefineDosDevice-uFlags-sDosDeviceName-sTargetPath"></a><code>DefineDosDevice( $uFlags, $sDosDeviceName, $sTargetPath )</code></dt>
<dd>

<p>Defines a new DOS device, overrides the current definition of a DOS device, or deletes a definition of a DOS device. Like most routines, returns a true value if successful and a false value [and sets <code>$^E</code> and <code>regLastError()</code>] on failure.</p>

<p><code>$sDosDeviceName</code> is the name of a DOS device for which we&#39;d like to add or delete a definition.</p>

<p><code>$uFlags</code> is an unsigned value with zero or more of the following bits set:</p>

<dl>

<dt id="DDD_RAW_TARGET_PATH"><a class="permalink" href="./Win32API::File.html#DDD_RAW_TARGET_PATH">#</a><code>DDD_RAW_TARGET_PATH</code></dt>
<dd>

<p>Indicates that <code>$sTargetPath</code> will be a raw Windows NT object name. This usually means that <code>$sTargetPath</code> starts with <code>&quot;\\Device\\&quot;</code>. Note that you cannot use <code>&quot;/&quot;</code> in place of <code>&quot;\\&quot;</code> in raw target path names.</p>

</dd>
<dt id="DDD_REMOVE_DEFINITION"><a class="permalink" href="./Win32API::File.html#DDD_REMOVE_DEFINITION">#</a><code>DDD_REMOVE_DEFINITION</code></dt>
<dd>

<p>Requests that a definition be deleted. If <code>$sTargetPath</code> is <code>[]</code> [for <code>NULL</code>], then the most recently added definition for <code>$sDosDeviceName</code> is removed. Otherwise the most recently added definition matching <code>$sTargetPath</code> is removed.</p>

<p>If the last definition is removed, then the DOS device name is also deleted.</p>

</dd>
<dt id="DDD_EXACT_MATCH_ON_REMOVE"><a class="permalink" href="./Win32API::File.html#DDD_EXACT_MATCH_ON_REMOVE">#</a><code>DDD_EXACT_MATCH_ON_REMOVE</code></dt>
<dd>

<p>When deleting a definition, this bit causes each <code>$sTargetPath</code> to be compared to the full-length definition when searching for the most recently added match. If this bit is not set, then <code>$sTargetPath</code> only needs to match a prefix of the definition.</p>

</dd>
</dl>

<p><code>$sTargetPath</code> is the DOS device&#39;s specific definition that you wish to add or delete. For <code>DDD_RAW_TARGET_PATH</code>, these usually start with <code>&quot;\\Device\\&quot;</code>. If the <code>DDD_RAW_TARGET_PATH</code> bit is not set, then <code>$sTargetPath</code> is just an ordinary path to some file or directory, providing the functionality of the <b>subst</b> command.</p>

</dd>
<dt id="DeleteFile"><a class="permalink" href="./Win32API::File.html#DeleteFile">#</a>DeleteFile</dt>
<dd>

</dd>
<dt id="DeleteFile(-$sFileName-)"><a class="permalink" href="./Win32API::File.html#DeleteFile(-$sFileName-)">#</a><a id="DeleteFile1"></a><a id="DeleteFile-sFileName"></a><code>DeleteFile( $sFileName )</code></dt>
<dd>

<p>Deletes the named file. Compared to Perl&#39;s <code>unlink</code>, <code>DeleteFile</code> has the advantage of not deleting read-only files. For <b>some</b> versions of Perl, <code>unlink</code> silently calls <code>chmod</code> whether it needs to or not before deleting the file so that files that you have protected by marking them as read-only are not always protected from Perl&#39;s <code>unlink</code>.</p>

<p>Like most routines, returns a true value if successful and a false value [and sets <code>$^E</code> and <code>regLastError()</code>] on failure.</p>

</dd>
<dt id="DeviceIoControl"><a class="permalink" href="./Win32API::File.html#DeviceIoControl">#</a>DeviceIoControl</dt>
<dd>

</dd>
<dt id="DeviceIoControl(-$hDevice,-$uIoControlCode,-$pInBuf,-$lInBuf,-$opOutBuf,-$lOutBuf,-$olRetBytes,-$pOverlapped-)"><a class="permalink" href="./Win32API::File.html#DeviceIoControl(-$hDevice,-$uIoControlCode,-$pInBuf,-$lInBuf,-$opOutBuf,-$lOutBuf,-$olRetBytes,-$pOverlapped-)">#</a><a id="DeviceIoControl1"></a><a id="DeviceIoControl-hDevice-uIoControlCode-pInBuf-lInBuf-opOutBuf-lOutBuf-olRetBytes-pOverlapped"></a><code>DeviceIoControl( $hDevice, $uIoControlCode, $pInBuf, $lInBuf, $opOutBuf, $lOutBuf, $olRetBytes, $pOverlapped )</code></dt>
<dd>

<p>Requests a special operation on an I/O [input/output] device, such as ejecting a tape or formatting a disk. Like most routines, returns a true value if successful and a false value [and sets <code>$^E</code> and <code>regLastError()</code>] on failure.</p>

<p><code>$hDevice</code> is a Win32 native file handle to a device [return value from <code>CreateFile</code>].</p>

<p><code>$uIoControlCode</code> is an unsigned value [a <code>IOCTL_*</code> or <code>FSCTL_*</code> constant] indicating the type query or other operation to be performed.</p>

<p><code>$pInBuf</code> is <code>[]</code> [for <code>NULL</code>] or a data structure packed into a string. The type of data structure depends on the <code>$uIoControlCode</code> value. <code>$lInBuf</code> is <code>0</code> or the length of the structure in <code>$pInBuf</code>. If <code>$pInBuf</code> is not <code>[]</code> and <code>$lInBuf</code> is <code>0</code>, then <code>$lInBuf</code> will automatically be set to <code>length($pInBuf)</code> for you.</p>

<p><code>$opOutBuf</code> is <code>[]</code> [for <code>NULL</code>] or will be set to contain a returned data structure packed into a string. <code>$lOutBuf</code> indicates how much space to allocate in <code>$opOutBuf</code> for <code>DeviceIoControl</code> to store the data structure. If <code>$lOutBuf</code> is a number and <code>$opOutBuf</code> already has a buffer allocated for it that is larger than <code>$lOutBuf</code> bytes, then this larger buffer size will be passed to <code>DeviceIoControl</code>. However, you can force a specific buffer size to be passed to <code>DeviceIoControl</code> by prepending a <code>&quot;=&quot;</code> to the front of <code>$lOutBuf</code>.</p>

<p><code>$olRetBytes</code> is <code>[]</code> or is a scalar to receive the number of bytes written to <code>$opOutBuf</code>. Even when <code>$olRetBytes</code> is <code>[]</code>, a valid pointer to a <code>DWORD</code> [and not <code>NULL</code>] is passed to <code>DeviceIoControl</code>. In this case, <code>[]</code> just means that you don&#39;t care about the value that might be written to <code>$olRetBytes</code>, which is usually the case since you can usually use <code>length($opOutBuf)</code> instead.</p>

<p><code>$pOverlapped</code> is <code>[]</code> or is a <code>OVERLAPPED</code> structure packed into a string. This is only useful if <code>$hDevice</code> was opened with the <code>FILE_FLAG_OVERLAPPED</code> flag set.</p>

</dd>
<dt id="FdGetOsFHandle"><a class="permalink" href="./Win32API::File.html#FdGetOsFHandle">#</a>FdGetOsFHandle</dt>
<dd>

</dd>
<dt id="$hNativeHandle=-FdGetOsFHandle(-$ivFd-)"><a class="permalink" href="./Win32API::File.html#$hNativeHandle=-FdGetOsFHandle(-$ivFd-)">#</a><a id="hNativeHandle-FdGetOsFHandle-ivFd"></a><code>$hNativeHandle= FdGetOsFHandle( $ivFd )</code></dt>
<dd>

<p><code>FdGetOsFHandle</code> simply calls <code>_get_osfhandle()</code>. It was renamed to better fit in with the rest the function names of this module, in particular to distinguish it from <code>GetOsFHandle</code>. It takes an integer file descriptor [as from Perl&#39;s <code>fileno</code>] and returns the Win32 native file handle associated with that file descriptor or <code>INVALID_HANDLE_VALUE</code> if <code>$ivFd</code> is not an open file descriptor.</p>

<p>When you call Perl&#39;s <code>open</code> to set a Perl file handle [like <code>STDOUT</code>], Perl calls C&#39;s <code>fopen</code> to set a stdio <code>FILE *</code>. C&#39;s <code>fopen</code> calls something like Unix&#39;s <code>open</code>, that is, Win32&#39;s <code>_sopen</code>, to get an integer file descriptor [where 0 is for <code>STDIN</code>, 1 for <code>STDOUT</code>, etc.]. Win32&#39;s <code>_sopen</code> calls <code>CreateFile</code> to set a <code>HANDLE</code>, a Win32 native file handle. So every Perl file handle [like <code>STDOUT</code>] has an integer file descriptor associated with it that you can get via <code>fileno</code>. And, under Win32, every file descriptor has a Win32 native file handle associated with it. <code>FdGetOsFHandle</code> lets you get access to that.</p>

<p><code>$hNativeHandle</code> is set to <code>INVALID_HANDLE_VALUE</code> [and <code>lastFileError()</code> and <code>$^E</code> are set] if <code>FdGetOsFHandle</code> fails. See also <code>GetOsFHandle</code> which provides a friendlier interface.</p>

</dd>
<dt id="fileConstant"><a class="permalink" href="./Win32API::File.html#fileConstant">#</a>fileConstant</dt>
<dd>

</dd>
<dt id="$value=-fileConstant(-$sConstantName-)"><a class="permalink" href="./Win32API::File.html#$value=-fileConstant(-$sConstantName-)">#</a><a id="value-fileConstant-sConstantName"></a><code>$value= fileConstant( $sConstantName )</code></dt>
<dd>

<p>Fetch the value of a constant. Returns <code>undef</code> if <code>$sConstantName</code> is not the name of a constant supported by this module. Never sets <code>$!</code> nor <code>$^E</code>.</p>

<p>This function is rarely used since you will usually get the value of a constant by having that constant imported into your package by listing the constant name in the <code>use Win32API::File</code> statement and then simply using the constant name in your code [perhaps followed by <code>()</code>]. This function is useful for verifying constant names not in Perl code, for example, after prompting a user to type in a constant name.</p>

</dd>
<dt id="fileLastError"><a class="permalink" href="./Win32API::File.html#fileLastError">#</a>fileLastError</dt>
<dd>

</dd>
<dt id="$svError=-fileLastError();"><a class="permalink" href="./Win32API::File.html#$svError=-fileLastError();">#</a><a id="svError-fileLastError"></a><code>$svError= fileLastError();</code></dt>
<dd>

</dd>
<dt id="fileLastError(-$uError-);"><a class="permalink" href="./Win32API::File.html#fileLastError(-$uError-);">#</a><a id="fileLastError1"></a><a id="fileLastError-uError"></a><code>fileLastError( $uError );</code></dt>
<dd>

<p>Returns the last error encountered by a routine from this module. It is just like <code>$^E</code> except it isn&#39;t changed by anything except routines from this module. Ideally you could just use <code>$^E</code>, but current versions of Perl often overwrite <code>$^E</code> before you get a chance to check it and really old versions of Perl don&#39;t really support <code>$^E</code> under Win32.</p>

<p>Just like <code>$^E</code>, in a numeric context <code>fileLastError()</code> returns the numeric error value while in a string context it returns a text description of the error [actually it returns a Perl scalar that contains both values so <code>$x= fileLastError()</code> causes <code>$x</code> to give different values in string vs. numeric contexts].</p>

<p>The last form sets the error returned by future calls to <code>fileLastError()</code> and should not be used often. <code>$uError</code> must be a numeric error code. Also returns the dual-valued version of <code>$uError</code>.</p>

</dd>
<dt id="GetDriveType"><a class="permalink" href="./Win32API::File.html#GetDriveType">#</a>GetDriveType</dt>
<dd>

</dd>
<dt id="$uDriveType=-GetDriveType(-$sRootPath-)"><a class="permalink" href="./Win32API::File.html#$uDriveType=-GetDriveType(-$sRootPath-)">#</a><a id="uDriveType-GetDriveType-sRootPath"></a><code>$uDriveType= GetDriveType( $sRootPath )</code></dt>
<dd>

<p>Takes a string giving the path to the root directory of a file system [called a &quot;drive&quot; because every file system is assigned a &quot;drive letter&quot;] and returns an unsigned value indicating the type of drive the file system is on. The return value should be one of:</p>

<dl>

<dt id="DRIVE_UNKNOWN"><a class="permalink" href="./Win32API::File.html#DRIVE_UNKNOWN">#</a><code>DRIVE_UNKNOWN</code></dt>
<dd>

<p>None of the following.</p>

</dd>
<dt id="DRIVE_NO_ROOT_DIR"><a class="permalink" href="./Win32API::File.html#DRIVE_NO_ROOT_DIR">#</a><code>DRIVE_NO_ROOT_DIR</code></dt>
<dd>

<p>A &quot;drive&quot; that does not have a file system. This can be a drive letter that hasn&#39;t been defined or a drive letter assigned to a partition that hasn&#39;t been formatted yet.</p>

</dd>
<dt id="DRIVE_REMOVABLE"><a class="permalink" href="./Win32API::File.html#DRIVE_REMOVABLE">#</a><code>DRIVE_REMOVABLE</code></dt>
<dd>

<p>A floppy diskette drive or other removable media drive, but not a CD-ROM drive.</p>

</dd>
<dt id="DRIVE_FIXED"><a class="permalink" href="./Win32API::File.html#DRIVE_FIXED">#</a><code>DRIVE_FIXED</code></dt>
<dd>

<p>An ordinary hard disk partition.</p>

</dd>
<dt id="DRIVE_REMOTE"><a class="permalink" href="./Win32API::File.html#DRIVE_REMOTE">#</a><code>DRIVE_REMOTE</code></dt>
<dd>

<p>A network share.</p>

</dd>
<dt id="DRIVE_CDROM"><a class="permalink" href="./Win32API::File.html#DRIVE_CDROM">#</a><code>DRIVE_CDROM</code></dt>
<dd>

<p>A CD-ROM drive.</p>

</dd>
<dt id="DRIVE_RAMDISK"><a class="permalink" href="./Win32API::File.html#DRIVE_RAMDISK">#</a><code>DRIVE_RAMDISK</code></dt>
<dd>

<p>A &quot;ram disk&quot; or memory-resident virtual file system used for high-speed access to small amounts of temporary file space.</p>

</dd>
</dl>

</dd>
<dt id="GetFileAttributes"><a class="permalink" href="./Win32API::File.html#GetFileAttributes">#</a>GetFileAttributes</dt>
<dd>

</dd>
<dt id="$uAttrs-=-GetFileAttributes(-$sPath-)"><a class="permalink" href="./Win32API::File.html#$uAttrs-=-GetFileAttributes(-$sPath-)">#</a><a id="uAttrs-GetFileAttributes-sPath"></a><code>$uAttrs = GetFileAttributes( $sPath )</code></dt>
<dd>

<p>Takes a path string and returns an unsigned value with attribute flags. If it fails, it returns INVALID_FILE_ATTRIBUTES, otherwise it can be one or more of the following values:</p>

<dl>

<dt id="FILE_ATTRIBUTE_ARCHIVE"><a class="permalink" href="./Win32API::File.html#FILE_ATTRIBUTE_ARCHIVE">#</a><code>FILE_ATTRIBUTE_ARCHIVE</code></dt>
<dd>

<p>The file or directory is an archive file or directory. Applications use this attribute to mark files for backup or removal.</p>

</dd>
<dt id="FILE_ATTRIBUTE_COMPRESSED"><a class="permalink" href="./Win32API::File.html#FILE_ATTRIBUTE_COMPRESSED">#</a><code>FILE_ATTRIBUTE_COMPRESSED</code></dt>
<dd>

<p>The file or directory is compressed. For a file, this means that all of the data in the file is compressed. For a directory, this means that compression is the default for newly created files and subdirectories.</p>

</dd>
<dt id="FILE_ATTRIBUTE_DEVICE"><a class="permalink" href="./Win32API::File.html#FILE_ATTRIBUTE_DEVICE">#</a><code>FILE_ATTRIBUTE_DEVICE</code></dt>
<dd>

<p>Reserved; do not use.</p>

</dd>
<dt id="FILE_ATTRIBUTE_DIRECTORY"><a class="permalink" href="./Win32API::File.html#FILE_ATTRIBUTE_DIRECTORY">#</a><code>FILE_ATTRIBUTE_DIRECTORY</code></dt>
<dd>

<p>The handle identifies a directory.</p>

</dd>
<dt id="FILE_ATTRIBUTE_ENCRYPTED"><a class="permalink" href="./Win32API::File.html#FILE_ATTRIBUTE_ENCRYPTED">#</a><code>FILE_ATTRIBUTE_ENCRYPTED</code></dt>
<dd>

<p>The file or directory is encrypted. For a file, this means that all data streams in the file are encrypted. For a directory, this means that encryption is the default for newly created files and subdirectories.</p>

</dd>
<dt id="FILE_ATTRIBUTE_HIDDEN"><a class="permalink" href="./Win32API::File.html#FILE_ATTRIBUTE_HIDDEN">#</a><code>FILE_ATTRIBUTE_HIDDEN</code></dt>
<dd>

<p>The file or directory is hidden. It is not included in an ordinary directory listing.</p>

</dd>
<dt id="FILE_ATTRIBUTE_NORMAL"><a class="permalink" href="./Win32API::File.html#FILE_ATTRIBUTE_NORMAL">#</a><code>FILE_ATTRIBUTE_NORMAL</code></dt>
<dd>

<p>The file or directory has no other attributes set. This attribute is valid only if used alone.</p>

</dd>
<dt id="FILE_ATTRIBUTE_NOT_CONTENT_INDEXED"><a class="permalink" href="./Win32API::File.html#FILE_ATTRIBUTE_NOT_CONTENT_INDEXED">#</a><code>FILE_ATTRIBUTE_NOT_CONTENT_INDEXED</code></dt>
<dd>

<p>The file will not be indexed by the content indexing service.</p>

</dd>
<dt id="FILE_ATTRIBUTE_OFFLINE"><a class="permalink" href="./Win32API::File.html#FILE_ATTRIBUTE_OFFLINE">#</a><code>FILE_ATTRIBUTE_OFFLINE</code></dt>
<dd>

<p>The data of the file is not immediately available. This attribute indicates that the file data has been physically moved to offline storage. This attribute is used by Remote Storage, the hierarchical storage management software. Applications should not arbitrarily change this attribute.</p>

</dd>
<dt id="FILE_ATTRIBUTE_READONLY"><a class="permalink" href="./Win32API::File.html#FILE_ATTRIBUTE_READONLY">#</a><code>FILE_ATTRIBUTE_READONLY</code></dt>
<dd>

<p>The file or directory is read-only. Applications can read the file but cannot write to it or delete it. In the case of a directory, applications cannot delete it.</p>

</dd>
<dt id="FILE_ATTRIBUTE_REPARSE_POINT"><a class="permalink" href="./Win32API::File.html#FILE_ATTRIBUTE_REPARSE_POINT">#</a><code>FILE_ATTRIBUTE_REPARSE_POINT</code></dt>
<dd>

<p>The file or directory has an associated reparse point.</p>

</dd>
<dt id="FILE_ATTRIBUTE_SPARSE_FILE"><a class="permalink" href="./Win32API::File.html#FILE_ATTRIBUTE_SPARSE_FILE">#</a><code>FILE_ATTRIBUTE_SPARSE_FILE</code></dt>
<dd>

<p>The file is a sparse file.</p>

</dd>
<dt id="FILE_ATTRIBUTE_SYSTEM"><a class="permalink" href="./Win32API::File.html#FILE_ATTRIBUTE_SYSTEM">#</a><code>FILE_ATTRIBUTE_SYSTEM</code></dt>
<dd>

<p>The file or directory is part of, or is used exclusively by, the operating system.</p>

</dd>
<dt id="FILE_ATTRIBUTE_TEMPORARY"><a class="permalink" href="./Win32API::File.html#FILE_ATTRIBUTE_TEMPORARY">#</a><code>FILE_ATTRIBUTE_TEMPORARY</code></dt>
<dd>

<p>The file is being used for temporary storage. File systems avoid writing data back to mass storage if sufficient cache memory is available, because often the application deletes the temporary file shortly after the handle is closed. In that case, the system can entirely avoid writing the data. Otherwise, the data will be written after the handle is closed.</p>

</dd>
</dl>

</dd>
<dt id="GetFileType"><a class="permalink" href="./Win32API::File.html#GetFileType">#</a>GetFileType</dt>
<dd>

</dd>
<dt id="$uFileType=-GetFileType(-$hFile-)"><a class="permalink" href="./Win32API::File.html#$uFileType=-GetFileType(-$hFile-)">#</a><a id="uFileType-GetFileType-hFile"></a><code>$uFileType= GetFileType( $hFile )</code></dt>
<dd>

<p>Takes a Win32 native file handle and returns a <code>FILE_TYPE_*</code> constant indicating the type of the file opened on that handle:</p>

<dl>

<dt id="FILE_TYPE_UNKNOWN"><a class="permalink" href="./Win32API::File.html#FILE_TYPE_UNKNOWN">#</a><code>FILE_TYPE_UNKNOWN</code></dt>
<dd>

<p>None of the below. Often a special device.</p>

</dd>
<dt id="FILE_TYPE_DISK"><a class="permalink" href="./Win32API::File.html#FILE_TYPE_DISK">#</a><code>FILE_TYPE_DISK</code></dt>
<dd>

<p>An ordinary disk file.</p>

</dd>
<dt id="FILE_TYPE_CHAR"><a class="permalink" href="./Win32API::File.html#FILE_TYPE_CHAR">#</a><code>FILE_TYPE_CHAR</code></dt>
<dd>

<p>What Unix would call a &quot;character special file&quot;, that is, a device that works on character streams such as a printer port or a console.</p>

</dd>
<dt id="FILE_TYPE_PIPE"><a class="permalink" href="./Win32API::File.html#FILE_TYPE_PIPE">#</a><code>FILE_TYPE_PIPE</code></dt>
<dd>

<p>Either a named or anonymous pipe.</p>

</dd>
</dl>

</dd>
<dt id="getFileSize"><a class="permalink" href="./Win32API::File.html#getFileSize">#</a>getFileSize</dt>
<dd>

</dd>
<dt id="$size=-getFileSize(-$hFile-)"><a class="permalink" href="./Win32API::File.html#$size=-getFileSize(-$hFile-)">#</a><a id="size-getFileSize-hFile"></a><code>$size= getFileSize( $hFile )</code></dt>
<dd>

<p>This is a Perl-friendly wrapper for the <code>GetFileSize</code> (below) API call.</p>

<p>It takes a Win32 native file handle and returns the size in bytes. Since the size can be a 64 bit value, on non 64 bit integer Perls the value returned will be an object of type <code>Math::BigInt</code>.</p>

</dd>
<dt id="GetFileSize"><a class="permalink" href="./Win32API::File.html#GetFileSize">#</a>GetFileSize</dt>
<dd>

</dd>
<dt id="$iSizeLow=-GetFileSize($win32Handle,-$iSizeHigh)"><a class="permalink" href="./Win32API::File.html#$iSizeLow=-GetFileSize($win32Handle,-$iSizeHigh)">#</a><a id="iSizeLow-GetFileSize-win32Handle-iSizeHigh"></a><code>$iSizeLow= GetFileSize($win32Handle, $iSizeHigh)</code></dt>
<dd>

<p>Returns the size of a file pointed to by <code>$win32Handle</code>, optionally storing the high order 32 bits into <code>$iSizeHigh</code> if it is not <code>[]</code>. If $iSizeHigh is <code>[]</code>, a non-zero value indicates success. Otherwise, on failure the return value will be <code>0xffffffff</code> and <code>fileLastError()</code> will not be <code>NO_ERROR</code>.</p>

</dd>
<dt id="GetOverlappedResult"><a class="permalink" href="./Win32API::File.html#GetOverlappedResult">#</a>GetOverlappedResult</dt>
<dd>

</dd>
<dt id="$bRetval=-GetOverlappedResult(-$win32Handle,-$pOverlapped,-$numBytesTransferred,-$bWait-)"><a class="permalink" href="./Win32API::File.html#$bRetval=-GetOverlappedResult(-$win32Handle,-$pOverlapped,-$numBytesTransferred,-$bWait-)">#</a><a id="bRetval-GetOverlappedResult-win32Handle-pOverlapped-numBytesTransferred-bWait"></a><code>$bRetval= GetOverlappedResult( $win32Handle, $pOverlapped, $numBytesTransferred, $bWait )</code></dt>
<dd>

<p>Used for asynchronous IO in Win32 to get the result of a pending IO operation, such as when a file operation returns <code>ERROR_IO_PENDING</code>. Returns a false value on failure. The <code>$overlapped</code> structure and <code>$numBytesTransferred</code> will be modified with the results of the operation.</p>

<p>As far as creating the <code>$pOverlapped</code> structure, you are currently on your own.</p>

<p>See <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/getoverlappedresult.asp">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/getoverlappedresult.asp</a> for more information.</p>

</dd>
<dt id="GetLogicalDrives"><a class="permalink" href="./Win32API::File.html#GetLogicalDrives">#</a>GetLogicalDrives</dt>
<dd>

</dd>
<dt id="$uDriveBits=-GetLogicalDrives()"><a class="permalink" href="./Win32API::File.html#$uDriveBits=-GetLogicalDrives()">#</a><a id="uDriveBits-GetLogicalDrives"></a><code>$uDriveBits= GetLogicalDrives()</code></dt>
<dd>

<p>Returns an unsigned value with one bit set for each drive letter currently defined. If &quot;A:&quot; is currently a valid drive letter, then the <code>1</code> bit will be set in <code>$uDriveBits</code>. If &quot;B:&quot; is valid, then the <code>2</code> bit will be set. If &quot;Z:&quot; is valid, then the <code>2**26</code> [<code>0x4000000</code>] bit will be set.</p>

</dd>
<dt id="GetLogicalDriveStrings"><a class="permalink" href="./Win32API::File.html#GetLogicalDriveStrings">#</a>GetLogicalDriveStrings</dt>
<dd>

</dd>
<dt id="$olOutLength=-GetLogicalDriveStrings(-$lBufSize,-$osBuffer-)"><a class="permalink" href="./Win32API::File.html#$olOutLength=-GetLogicalDriveStrings(-$lBufSize,-$osBuffer-)">#</a><a id="olOutLength-GetLogicalDriveStrings-lBufSize-osBuffer"></a><code>$olOutLength= GetLogicalDriveStrings( $lBufSize, $osBuffer )</code></dt>
<dd>

<p>For each currently defined drive letter, a <code>&#39;\0&#39;</code>-terminated string of the path to the root of its file system is constructed. All of these strings are concatenated into a single larger string and an extra terminating <code>&#39;\0&#39;</code> is added. This larger string is returned in <code>$osBuffer</code>. Note that this includes drive letters that have been defined but that have no file system, such as drive letters assigned to unformatted partitions.</p>

<p><code>$lBufSize</code> is the size of the buffer to allocate to store this list of strings. <code>26*4+1</code> is always sufficient and should usually be used.</p>

<p><code>$osBuffer</code> is a scalar to be set to contain the constructed string.</p>

<p><code>$olOutLength</code> is the number of bytes actually written to <code>$osBuffer</code> but <code>length($osBuffer)</code> can also be used to determine this.</p>

<p>For example, on a poorly equipped computer,</p>

<pre><code>GetLogicalDriveStrings( 4*26+1, $osBuffer );</code></pre>

<p>might set <code>$osBuffer</code> to the 9-character string, <code>&quot;A:\\\0C:\\\0\0&quot;</code>.</p>

</dd>
<dt id="GetHandleInformation"><a class="permalink" href="./Win32API::File.html#GetHandleInformation">#</a>GetHandleInformation</dt>
<dd>

</dd>
<dt id="GetHandleInformation(-$hObject,-$ouFlags-)"><a class="permalink" href="./Win32API::File.html#GetHandleInformation(-$hObject,-$ouFlags-)">#</a><a id="GetHandleInformation1"></a><a id="GetHandleInformation-hObject-ouFlags"></a><code>GetHandleInformation( $hObject, $ouFlags )</code></dt>
<dd>

<p>Retrieves the flags associated with a Win32 native file handle or object handle.</p>

<p><code>$hObject</code> is an open Win32 native file handle or an open Win32 native handle to some other type of object.</p>

<p><code>$ouFlags</code> will be set to an unsigned value having zero or more of the bits <code>HANDLE_FLAG_INHERIT</code> and <code>HANDLE_FLAG_PROTECT_FROM_CLOSE</code> set. See the <code>&quot;:HANDLE_FLAG_&quot;</code> export class for the meanings of these bits.</p>

</dd>
<dt id="GetOsFHandle"><a class="permalink" href="./Win32API::File.html#GetOsFHandle">#</a>GetOsFHandle</dt>
<dd>

</dd>
<dt id="$hNativeHandle=-GetOsFHandle(-FILE-)"><a class="permalink" href="./Win32API::File.html#$hNativeHandle=-GetOsFHandle(-FILE-)">#</a><a id="hNativeHandle-GetOsFHandle-FILE"></a><code>$hNativeHandle= GetOsFHandle( FILE )</code></dt>
<dd>

<p>Takes a Perl file handle [like <code>STDIN</code>] and returns the Win32 native file handle associated with it. See <code>FdGetOsFHandle</code> for more information about Win32 native file handles.</p>

<p><code>$hNativeHandle</code> is set to a false value [and <code>lastFileError()</code> and <code>$^E</code> are set] if <code>GetOsFHandle</code> fails. <code>GetOsFHandle</code> returns <code>&quot;0 but true&quot;</code> in the impossible(?) case of the handle having a value of <code>0</code>.</p>

</dd>
<dt id="GetVolumeInformation"><a class="permalink" href="./Win32API::File.html#GetVolumeInformation">#</a>GetVolumeInformation</dt>
<dd>

</dd>
<dt id="GetVolumeInformation(-$sRootPath,-$osVolName,-$lVolName,-$ouSerialNum,-$ouMaxNameLen,-$ouFsFlags,-$osFsType,-$lFsType-)"><a class="permalink" href="./Win32API::File.html#GetVolumeInformation(-$sRootPath,-$osVolName,-$lVolName,-$ouSerialNum,-$ouMaxNameLen,-$ouFsFlags,-$osFsType,-$lFsType-)">#</a><a id="GetVolumeInformation1"></a><a id="GetVolumeInformation-sRootPath-osVolName-lVolName-ouSerialNum-ouMaxNameLen-ouFsFlags-osFsType-lFsType"></a><code>GetVolumeInformation( $sRootPath, $osVolName, $lVolName, $ouSerialNum, $ouMaxNameLen, $ouFsFlags, $osFsType, $lFsType )</code></dt>
<dd>

<p>Gets information about a file system volume, returning a true value if successful. On failure, returns a false value and sets <code>fileLastError()</code> and <code>$^E</code>.</p>

<p><code>$sRootPath</code> is a string specifying the path to the root of the file system, for example, <code>&quot;C:/&quot;</code>.</p>

<p><code>$osVolName</code> is a scalar to be set to the string representing the volume name, also called the file system label. <code>$lVolName</code> is the number of bytes to allocate for the <code>$osVolName</code> buffer [see <a href="./Win32API::File.html#Buffer-Sizes">&quot;Buffer Sizes&quot;</a> for more information].</p>

<p><code>$ouSerialNum</code> is <code>[]</code> [for <code>NULL</code>] or will be set to the numeric value of the volume&#39;s serial number.</p>

<p><code>$ouMaxNameLen</code> is <code>[]</code> [for <code>NULL</code>] or will be set to the maximum length allowed for a file name or directory name within the file system.</p>

<p><code>$osFsType</code> is a scalar to be set to the string representing the file system type, such as <code>&quot;FAT&quot;</code> or <code>&quot;NTFS&quot;</code>. <code>$lFsType</code> is the number of bytes to allocate for the <code>$osFsType</code> buffer [see <a href="./Win32API::File.html#Buffer-Sizes">&quot;Buffer Sizes&quot;</a> for more information].</p>

<p><code>$ouFsFlags</code> is <code>[]</code> [for <code>NULL</code>] or will be set to an unsigned integer with bits set indicating properties of the file system:</p>

<dl>

<dt id="FS_CASE_IS_PRESERVED"><a class="permalink" href="./Win32API::File.html#FS_CASE_IS_PRESERVED">#</a><code>FS_CASE_IS_PRESERVED</code></dt>
<dd>

<p>The file system preserves the case of file names [usually true]. That is, it doesn&#39;t change the case of file names such as forcing them to upper- or lower-case.</p>

</dd>
<dt id="FS_CASE_SENSITIVE"><a class="permalink" href="./Win32API::File.html#FS_CASE_SENSITIVE">#</a><code>FS_CASE_SENSITIVE</code></dt>
<dd>

<p>The file system supports the ability to not ignore the case of file names [but might ignore case the way you are using it]. That is, the file system has the ability to force you to get the letter case of a file&#39;s name exactly right to be able to open it. This is true for &quot;NTFS&quot; file systems, even though case in file names is usually still ignored.</p>

</dd>
<dt id="FS_UNICODE_STORED_ON_DISK"><a class="permalink" href="./Win32API::File.html#FS_UNICODE_STORED_ON_DISK">#</a><code>FS_UNICODE_STORED_ON_DISK</code></dt>
<dd>

<p>The file system preserves Unicode in file names [true for &quot;NTFS&quot;].</p>

</dd>
<dt id="FS_PERSISTENT_ACLS"><a class="permalink" href="./Win32API::File.html#FS_PERSISTENT_ACLS">#</a><code>FS_PERSISTENT_ACLS</code></dt>
<dd>

<p>The file system supports setting Access Control Lists on files [true for &quot;NTFS&quot;].</p>

</dd>
<dt id="FS_FILE_COMPRESSION"><a class="permalink" href="./Win32API::File.html#FS_FILE_COMPRESSION">#</a><code>FS_FILE_COMPRESSION</code></dt>
<dd>

<p>The file system supports compression on a per-file basis [true for &quot;NTFS&quot;].</p>

</dd>
<dt id="FS_VOL_IS_COMPRESSED"><a class="permalink" href="./Win32API::File.html#FS_VOL_IS_COMPRESSED">#</a><code>FS_VOL_IS_COMPRESSED</code></dt>
<dd>

<p>The entire file system is compressed such as via &quot;DoubleSpace&quot;.</p>

</dd>
</dl>

</dd>
<dt id="IsRecognizedPartition"><a class="permalink" href="./Win32API::File.html#IsRecognizedPartition">#</a>IsRecognizedPartition</dt>
<dd>

</dd>
<dt id="IsRecognizedPartition(-$ivPartitionType-)"><a class="permalink" href="./Win32API::File.html#IsRecognizedPartition(-$ivPartitionType-)">#</a><a id="IsRecognizedPartition1"></a><a id="IsRecognizedPartition-ivPartitionType"></a><code>IsRecognizedPartition( $ivPartitionType )</code></dt>
<dd>

<p>Takes a partition type and returns whether that partition type is supported under Win32. <code>$ivPartitonType</code> is an integer value as from the operating system byte of a hard disk&#39;s DOS-compatible partition table [that is, a partition table for x86-based Win32, not, for example, one used with Windows NT for Alpha processors]. For example, the <code>PartitionType</code> member of the <code>PARTITION_INFORMATION</code> structure.</p>

<p>Common values for <code>$ivPartitionType</code> include <code>PARTITION_FAT_12==1</code>, <code>PARTITION_FAT_16==4</code>, <code>PARTITION_EXTENDED==5</code>, <code>PARTITION_FAT32==0xB</code>.</p>

</dd>
<dt id="IsContainerPartition"><a class="permalink" href="./Win32API::File.html#IsContainerPartition">#</a>IsContainerPartition</dt>
<dd>

</dd>
<dt id="IsContainerPartition(-$ivPartitionType-)"><a class="permalink" href="./Win32API::File.html#IsContainerPartition(-$ivPartitionType-)">#</a><a id="IsContainerPartition1"></a><a id="IsContainerPartition-ivPartitionType"></a><code>IsContainerPartition( $ivPartitionType )</code></dt>
<dd>

<p>Takes a partition type and returns whether that partition is a &quot;container&quot; partition that is supported under Win32, that is, whether it is an &quot;extended&quot; partition that can contain &quot;logical&quot; partitions. <code>$ivPartitonType</code> is as for <code>IsRecognizedPartition</code>.</p>

</dd>
<dt id="MoveFile"><a class="permalink" href="./Win32API::File.html#MoveFile">#</a>MoveFile</dt>
<dd>

</dd>
<dt id="MoveFile(-$sOldName,-$sNewName-)"><a class="permalink" href="./Win32API::File.html#MoveFile(-$sOldName,-$sNewName-)">#</a><a id="MoveFile1"></a><a id="MoveFile-sOldName-sNewName"></a><code>MoveFile( $sOldName, $sNewName )</code></dt>
<dd>

<p>Renames a file or directory. <code>$sOldName</code> is the name of the existing file or directory that is to be renamed. <code>$sNewName</code> is the new name to give the file or directory. Returns a true value if the move succeeds. For failure, returns a false value and sets <code>fileLastErorr()</code> and <code>$^E</code> to the reason for the failure.</p>

<p>Files can be &quot;renamed&quot; between file systems and the file contents and some attributes will be moved. Directories can only be renamed within one file system. If there is already a file or directory named <code>$sNewName</code>, then <code>MoveFile</code> will fail.</p>

</dd>
<dt id="MoveFileEx"><a class="permalink" href="./Win32API::File.html#MoveFileEx">#</a>MoveFileEx</dt>
<dd>

</dd>
<dt id="MoveFileEx(-$sOldName,-$sNewName,-$uFlags-)"><a class="permalink" href="./Win32API::File.html#MoveFileEx(-$sOldName,-$sNewName,-$uFlags-)">#</a><a id="MoveFileEx1"></a><a id="MoveFileEx-sOldName-sNewName-uFlags"></a><code>MoveFileEx( $sOldName, $sNewName, $uFlags )</code></dt>
<dd>

<p>Renames a file or directory. <code>$sOldName</code> is the name of the existing file or directory that is to be renamed. <code>$sNewName</code> is the new name to give the file or directory. Returns a true value if the move succeeds. For failure, returns a false value and sets <code>fileLastErorr()</code> and <code>$^E</code> to the reason for the failure.</p>

<p><code>$uFlags</code> is an unsigned value with zero or more of the following bits set:</p>

<dl>

<dt id="MOVEFILE_REPLACE_EXISTING"><a class="permalink" href="./Win32API::File.html#MOVEFILE_REPLACE_EXISTING">#</a><code>MOVEFILE_REPLACE_EXISTING</code></dt>
<dd>

<p>If this bit is set and a file [but not a directory] named <code>$sNewName</code> already exists, then it will be replaced by <code>$sOldName</code>. If this bit is not set then <code>MoveFileEx</code> will fail rather than replace an existing <code>$sNewName</code>.</p>

</dd>
<dt id="MOVEFILE_COPY_ALLOWED"><a class="permalink" href="./Win32API::File.html#MOVEFILE_COPY_ALLOWED">#</a><code>MOVEFILE_COPY_ALLOWED</code></dt>
<dd>

<p>Allows files [but not directories] to be moved between file systems by copying the <code>$sOldName</code> file data and some attributes to <code>$sNewName</code> and then deleting <code>$sOldName</code>. If this bit is not set [or if <code>$sOldName</code> denotes a directory] and <code>$sNewName</code> refers to a different file system than <code>$sOldName</code>, then <code>MoveFileEx</code> will fail.</p>

</dd>
<dt id="MOVEFILE_DELAY_UNTIL_REBOOT"><a class="permalink" href="./Win32API::File.html#MOVEFILE_DELAY_UNTIL_REBOOT">#</a><code>MOVEFILE_DELAY_UNTIL_REBOOT</code></dt>
<dd>

<p>Preliminary verifications are made and then an entry is added to the Registry to cause the rename [or delete] operation to be done the next time this copy of the operating system is booted [right after any automatic file system checks have completed]. This is not supported under Windows 95.</p>

<p>When this bit is set, <code>$sNewName</code> can be <code>[]</code> [for <code>NULL</code>] to indicate that <code>$sOldName</code> should be deleted during the next boot rather than renamed.</p>

<p>Setting both the <code>MOVEFILE_COPY_ALLOWED</code> and <code>MOVEFILE_DELAY_UNTIL_REBOOT</code> bits will cause <code>MoveFileEx</code> to fail.</p>

</dd>
<dt id="MOVEFILE_WRITE_THROUGH"><a class="permalink" href="./Win32API::File.html#MOVEFILE_WRITE_THROUGH">#</a><code>MOVEFILE_WRITE_THROUGH</code></dt>
<dd>

<p>Ensures that <code>MoveFileEx</code> won&#39;t return until the operation has finished and been flushed to disk. This is not supported under Windows 95. Only affects file renames to another file system, forcing a buffer flush at the end of the copy operation.</p>

</dd>
</dl>

</dd>
<dt id="OsFHandleOpen"><a class="permalink" href="./Win32API::File.html#OsFHandleOpen">#</a>OsFHandleOpen</dt>
<dd>

</dd>
<dt id="OsFHandleOpen(-FILE,-$hNativeHandle,-$sMode-)"><a class="permalink" href="./Win32API::File.html#OsFHandleOpen(-FILE,-$hNativeHandle,-$sMode-)">#</a><a id="OsFHandleOpen1"></a><a id="OsFHandleOpen-FILE-hNativeHandle-sMode"></a><code>OsFHandleOpen( FILE, $hNativeHandle, $sMode )</code></dt>
<dd>

<p>Opens a Perl file handle based on an already open Win32 native file handle [much like C&#39;s <code>fdopen()</code> does with a file descriptor]. Returns a true value if the open operation succeeded. For failure, returns a false value and sets <code>$!</code> [and possibly <code>fileLastError()</code> and <code>$^E</code>] to the reason for the failure.</p>

<p><code>FILE</code> is a Perl file handle [in any of the supported forms, a bareword, a string, a typeglob, or a reference to a typeglob] that will be opened. If <code>FILE</code> is already open, it will automatically be closed before it is reopened.</p>

<p><code>$hNativeHandle</code> is an open Win32 native file handle, probably the return value from <code>CreateFile</code> or <code>createFile</code>.</p>

<p><code>$sMode</code> is string of zero or more letters from <code>&quot;rwatb&quot;</code>. These are translated into a combination <code>O_RDONLY</code> [<code>&quot;r&quot;</code>], <code>O_WRONLY</code> [<code>&quot;w&quot;</code>], <code>O_RDWR</code> [<code>&quot;rw&quot;</code>], <code>O_APPEND</code> [<code>&quot;a&quot;</code>], <code>O_TEXT</code> [<code>&quot;t&quot;</code>], and <code>O_BINARY</code> [<code>&quot;b&quot;</code>] flags [see the <a href="Fcntl.html">Fcntl</a> module] that is passed to <code>OsFHandleOpenFd</code>. Currently only <code>O_APPEND</code> and <code>O_TEXT</code> have any significance.</p>

<p>Also, a <code>&quot;r&quot;</code> and/or <code>&quot;w&quot;</code> in <code>$sMode</code> is used to decide how the file descriptor is converted into a Perl file handle, even though this doesn&#39;t appear to make a difference. One of the following is used:</p>

<pre><code>open( FILE, &quot;&lt;&amp;=&quot;.$ivFd )	# &quot;r&quot; w/o &quot;w&quot;
open( FILE, &quot;&gt;&amp;=&quot;.$ivFd )	# &quot;w&quot; w/o &quot;r&quot;
open( FILE, &quot;+&lt;&amp;=&quot;.$ivFd )	# both &quot;r&quot; and &quot;w&quot;</code></pre>

<p><code>OsFHandleOpen</code> eventually calls the Win32-specific C routine <code>_open_osfhandle()</code> or Perl&#39;s &quot;improved&quot; version called <code>win32_open_osfhandle()</code>. Prior to Perl5.005, C&#39;s <code>_open_osfhandle()</code> is called which will fail if <code>GetFileType($hNativeHandle)</code> would return <code>FILE_TYPE_UNKNOWN</code>. For Perl5.005 and later, <code>OsFHandleOpen</code> calls <code>win32_open_osfhandle()</code> from the Perl DLL which doesn&#39;t have this restriction.</p>

</dd>
<dt id="OsFHandleOpenFd"><a class="permalink" href="./Win32API::File.html#OsFHandleOpenFd">#</a>OsFHandleOpenFd</dt>
<dd>

</dd>
<dt id="$ivFD=-OsFHandleOpenFd(-$hNativeHandle,-$uMode-)"><a class="permalink" href="./Win32API::File.html#$ivFD=-OsFHandleOpenFd(-$hNativeHandle,-$uMode-)">#</a><a id="ivFD-OsFHandleOpenFd-hNativeHandle-uMode"></a><code>$ivFD= OsFHandleOpenFd( $hNativeHandle, $uMode )</code></dt>
<dd>

<p>Opens a file descriptor [<code>$ivFD</code>] based on an already open Win32 native file handle, <code>$hNativeHandle</code>. This just calls the Win32-specific C routine <code>_open_osfhandle()</code> or Perl&#39;s &quot;improved&quot; version called <code>win32_open_osfhandle()</code>. Prior to Perl5.005 and in Cygwin Perl, C&#39;s <code>_open_osfhandle()</code> is called which will fail if <code>GetFileType($hNativeHandle)</code> would return <code>FILE_TYPE_UNKNOWN</code>. For Perl5.005 and later, <code>OsFHandleOpenFd</code> calls <code>win32_open_osfhandle()</code> from the Perl DLL which doesn&#39;t have this restriction.</p>

<p><code>$uMode</code> the logical combination of zero or more <code>O_*</code> constants exported by the <code>Fcntl</code> module. Currently only <code>O_APPEND</code> and <code>O_TEXT</code> have any significance.</p>

<p><code>$ivFD</code> will be non-negative if the open operation was successful. For failure, <code>-1</code> is returned and <code>$!</code> [and possibly <code>fileLastError()</code> and <code>$^E</code>] is set to the reason for the failure.</p>

</dd>
<dt id="QueryDosDevice"><a class="permalink" href="./Win32API::File.html#QueryDosDevice">#</a>QueryDosDevice</dt>
<dd>

</dd>
<dt id="$olTargetLen=-QueryDosDevice(-$sDosDeviceName,-$osTargetPath,-$lTargetBuf-)"><a class="permalink" href="./Win32API::File.html#$olTargetLen=-QueryDosDevice(-$sDosDeviceName,-$osTargetPath,-$lTargetBuf-)">#</a><a id="olTargetLen-QueryDosDevice-sDosDeviceName-osTargetPath-lTargetBuf"></a><code>$olTargetLen= QueryDosDevice( $sDosDeviceName, $osTargetPath, $lTargetBuf )</code></dt>
<dd>

<p>Looks up the definition of a given &quot;DOS&quot; device name, yielding the active Windows NT native device name along with any currently dormant definitions.</p>

<p><code>$sDosDeviceName</code> is the name of the &quot;DOS&quot; device whose definitions we want. For example, <code>&quot;C:&quot;</code>, <code>&quot;COM1&quot;</code>, or <code>&quot;PhysicalDrive0&quot;</code>. If <code>$sDosDeviceName</code> is <code>[]</code> [for <code>NULL</code>], the list of all DOS device names is returned instead.</p>

<p><code>$osTargetPath</code> will be assigned a string containing the list of definitions. The definitions are each <code>&#39;\0&#39;</code>-terminate and are concatenated into the string, most recent first, with an extra <code>&#39;\0&#39;</code> at the end of the whole string [see <code>GetLogicalDriveStrings</code> for a sample of this format].</p>

<p><code>$lTargetBuf</code> is the size [in bytes] of the buffer to allocate for <code>$osTargetPath</code>. See <a href="./Win32API::File.html#Buffer-Sizes">&quot;Buffer Sizes&quot;</a> for more information.</p>

<p><code>$olTargetLen</code> is set to the number of bytes written to <code>$osTargetPath</code> but you can also use <code>length($osTargetPath)</code> to determine this.</p>

<p>For failure, <code>0</code> is returned and <code>fileLastError()</code> and <code>$^E</code> are set to the reason for the failure.</p>

</dd>
<dt id="ReadFile"><a class="permalink" href="./Win32API::File.html#ReadFile">#</a>ReadFile</dt>
<dd>

</dd>
<dt id="ReadFile(-$hFile,-$opBuffer,-$lBytes,-$olBytesRead,-$pOverlapped-)"><a class="permalink" href="./Win32API::File.html#ReadFile(-$hFile,-$opBuffer,-$lBytes,-$olBytesRead,-$pOverlapped-)">#</a><a id="ReadFile1"></a><a id="ReadFile-hFile-opBuffer-lBytes-olBytesRead-pOverlapped"></a><code>ReadFile( $hFile, $opBuffer, $lBytes, $olBytesRead, $pOverlapped )</code></dt>
<dd>

<p>Reads bytes from a file or file-like device. Returns a true value if the read operation was successful. For failure, returns a false value and sets <code>fileLastError()</code> and <code>$^E</code> for the reason for the failure.</p>

<p><code>$hFile</code> is a Win32 native file handle that is already open to the file or device to read from.</p>

<p><code>$opBuffer</code> will be set to a string containing the bytes read.</p>

<p><code>$lBytes</code> is the number of bytes you would like to read. <code>$opBuffer</code> is automatically initialized to have a buffer large enough to hold that many bytes. Unlike other buffer sizes, <code>$lBytes</code> does not need to have a <code>&quot;=&quot;</code> prepended to it to prevent a larger value to be passed to the underlying Win32 <code>ReadFile</code> API. However, a leading <code>&quot;=&quot;</code> will be silently ignored, even if Perl warnings are enabled.</p>

<p>If <code>$olBytesRead</code> is not <code>[]</code>, it will be set to the actual number of bytes read, though <code>length($opBuffer)</code> can also be used to determine this.</p>

<p><code>$pOverlapped</code> is <code>[]</code> or is a <code>OVERLAPPED</code> structure packed into a string. This is only useful if <code>$hFile</code> was opened with the <code>FILE_FLAG_OVERLAPPED</code> flag set.</p>

</dd>
<dt id="SetErrorMode"><a class="permalink" href="./Win32API::File.html#SetErrorMode">#</a>SetErrorMode</dt>
<dd>

</dd>
<dt id="$uOldMode=-SetErrorMode(-$uNewMode-)"><a class="permalink" href="./Win32API::File.html#$uOldMode=-SetErrorMode(-$uNewMode-)">#</a><a id="uOldMode-SetErrorMode-uNewMode"></a><code>$uOldMode= SetErrorMode( $uNewMode )</code></dt>
<dd>

<p>Sets the mode controlling system error handling <b>and</b> returns the previous mode value. Both <code>$uOldMode</code> and <code>$uNewMode</code> will have zero or more of the following bits set:</p>

<dl>

<dt id="SEM_FAILCRITICALERRORS"><a class="permalink" href="./Win32API::File.html#SEM_FAILCRITICALERRORS">#</a><code>SEM_FAILCRITICALERRORS</code></dt>
<dd>

<p>If set, indicates that when a critical error is encountered, the call that triggered the error fails immediately. Normally this bit is not set, which means that a critical error causes a dialogue box to appear notifying the desktop user that some application has triggered a critical error. The dialogue box allows the desktop user to decide whether the critical error is returned to the process, is ignored, or the offending operation is retried.</p>

<p>This affects the <code>CreateFile</code> and <code>GetVolumeInformation</code> calls.</p>

<p>Setting this bit is useful for allowing you to check whether a floppy diskette is in the floppy drive.</p>

</dd>
<dt id="SEM_NOALIGNMENTFAULTEXCEPT"><a class="permalink" href="./Win32API::File.html#SEM_NOALIGNMENTFAULTEXCEPT">#</a><code>SEM_NOALIGNMENTFAULTEXCEPT</code></dt>
<dd>

<p>If set, this causes memory access misalignment faults to be automatically fixed in a manner invisible to the process. This flag is ignored on x86-based versions of Windows NT. This flag is not supported on Windows 95.</p>

</dd>
<dt id="SEM_NOGPFAULTERRORBOX"><a class="permalink" href="./Win32API::File.html#SEM_NOGPFAULTERRORBOX">#</a><code>SEM_NOGPFAULTERRORBOX</code></dt>
<dd>

<p>If set, general protection faults do not generate a dialogue box but can instead be handled by the process via an exception handler. This bit should not be set by programs that don&#39;t know how to handle such faults.</p>

</dd>
<dt id="SEM_NOOPENFILEERRORBOX"><a class="permalink" href="./Win32API::File.html#SEM_NOOPENFILEERRORBOX">#</a><code>SEM_NOOPENFILEERRORBOX</code></dt>
<dd>

<p>If set, then when an attempt to continue reading from or writing to an already open file [usually on a removable medium like a floppy diskette] finds the file no longer available, the call will immediately fail. Normally this bit is not set, which means that instead a dialogue box will appear notifying the desktop user that some application has run into this problem. The dialogue box allows the desktop user to decide whether the failure is returned to the process, is ignored, or the offending operation is retried.</p>

<p>This affects the <code>ReadFile</code> and <code>WriteFile</code> calls.</p>

</dd>
</dl>

</dd>
<dt id="setFilePointer"><a class="permalink" href="./Win32API::File.html#setFilePointer">#</a>setFilePointer</dt>
<dd>

</dd>
<dt id="$uNewPos-=-setFilePointer(-$hFile,-$ivOffset,-$uFromWhere-)"><a class="permalink" href="./Win32API::File.html#$uNewPos-=-setFilePointer(-$hFile,-$ivOffset,-$uFromWhere-)">#</a><a id="uNewPos-setFilePointer-hFile-ivOffset-uFromWhere"></a><code>$uNewPos = setFilePointer( $hFile, $ivOffset, $uFromWhere )</code></dt>
<dd>

<p>This is a perl-friendly wrapper for the SetFilePointer API (below). <code>$ivOffset</code> can be a 64 bit integer or <code>Math::BigInt</code> object if your Perl doesn&#39;t have 64 bit integers. The return value is the new offset and will likewise be a 64 bit integer or a <code>Math::BigInt</code> object.</p>

</dd>
<dt id="SetFilePointer"><a class="permalink" href="./Win32API::File.html#SetFilePointer">#</a>SetFilePointer</dt>
<dd>

</dd>
<dt id="$uNewPos-=-SetFilePointer(-$hFile,-$ivOffset,-$ioivOffsetHigh,-$uFromWhere-)"><a class="permalink" href="./Win32API::File.html#$uNewPos-=-SetFilePointer(-$hFile,-$ivOffset,-$ioivOffsetHigh,-$uFromWhere-)">#</a><a id="uNewPos-SetFilePointer-hFile-ivOffset-ioivOffsetHigh-uFromWhere"></a><code>$uNewPos = SetFilePointer( $hFile, $ivOffset, $ioivOffsetHigh, $uFromWhere )</code></dt>
<dd>

<p>The native Win32 version of <code>seek()</code>. <code>SetFilePointer</code> sets the position within a file where the next read or write operation will start from.</p>

<p><code>$hFile</code> is a Win32 native file handle.</p>

<p><code>$uFromWhere</code> is either <code>FILE_BEGIN</code>, <code>FILE_CURRENT</code>, or <code>FILE_END</code>, indicating that the new file position is being specified relative to the beginning of the file, the current file pointer, or the end of the file, respectively.</p>

<p><code>$ivOffset</code> is [if <code>$ioivOffsetHigh</code> is <code>[]</code>] the offset [in bytes] to the new file position from the position specified via <code>$uFromWhere</code>. If <code>$ioivOffsetHigh</code> is not <code>[]</code>, then <code>$ivOffset</code> is converted to an unsigned value to be used as the low-order 4 bytes of the offset.</p>

<p><code>$ioivOffsetHigh</code> can be <code>[]</code> [for <code>NULL</code>] to indicate that you are only specifying a 4-byte offset and the resulting file position will be 0xFFFFFFFE or less [just under 4GB]. Otherwise <code>$ioivOfffsetHigh</code> starts out with the high-order 4 bytes [signed] of the offset and gets set to the [unsigned] high-order 4 bytes of the resulting file position.</p>

<p>The underlying <code>SetFilePointer</code> returns <code>0xFFFFFFFF</code> to indicate failure, but if <code>$ioivOffsetHigh</code> is not <code>[]</code>, you would also have to check <code>$^E</code> to determine whether <code>0xFFFFFFFF</code> indicates an error or not. <code>Win32API::File::SetFilePointer</code> does this checking for you and returns a false value if and only if the underlying <code>SetFilePointer</code> failed. For this reason, <code>$uNewPos</code> is set to <code>&quot;0 but true&quot;</code> if you set the file pointer to the beginning of the file [or any position with 0 for the low-order 4 bytes].</p>

<p>So the return value will be true if the seek operation was successful. For failure, a false value is returned and <code>fileLastError()</code> and <code>$^E</code> are set to the reason for the failure.</p>

</dd>
<dt id="SetHandleInformation"><a class="permalink" href="./Win32API::File.html#SetHandleInformation">#</a>SetHandleInformation</dt>
<dd>

</dd>
<dt id="SetHandleInformation(-$hObject,-$uMask,-$uFlags-)"><a class="permalink" href="./Win32API::File.html#SetHandleInformation(-$hObject,-$uMask,-$uFlags-)">#</a><a id="SetHandleInformation1"></a><a id="SetHandleInformation-hObject-uMask-uFlags"></a><code>SetHandleInformation( $hObject, $uMask, $uFlags )</code></dt>
<dd>

<p>Sets the flags associated with a Win32 native file handle or object handle. Returns a true value if the operation was successful. For failure, returns a false value and sets <code>fileLastError()</code> and <code>$^E</code> for the reason for the failure.</p>

<p><code>$hObject</code> is an open Win32 native file handle or an open Win32 native handle to some other type of object.</p>

<p><code>$uMask</code> is an unsigned value having one or more of the bits <code>HANDLE_FLAG_INHERIT</code> and <code>HANDLE_FLAG_PROTECT_FROM_CLOSE</code> set. Only bits set in <code>$uMask</code> will be modified by <code>SetHandleInformation</code>.</p>

<p><code>$uFlags</code> is an unsigned value having zero or more of the bits <code>HANDLE_FLAG_INHERIT</code> and <code>HANDLE_FLAG_PROTECT_FROM_CLOSE</code> set. For each bit set in <code>$uMask</code>, the corresponding bit in the handle&#39;s flags is set to the value of the corresponding bit in <code>$uFlags</code>.</p>

<p>If <code>$uOldFlags</code> were the value of the handle&#39;s flags before the call to <code>SetHandleInformation</code>, then the value of the handle&#39;s flags afterward would be:</p>

<pre><code>( $uOldFlags &amp; ~$uMask ) | ( $uFlags &amp; $uMask )</code></pre>

<p>[at least as far as the <code>HANDLE_FLAG_INHERIT</code> and <code>HANDLE_FLAG_PROTECT_FROM_CLOSE</code> bits are concerned.]</p>

<p>See the <code>&quot;:HANDLE_FLAG_&quot;</code> export class for the meanings of these bits.</p>

</dd>
<dt id="WriteFile"><a class="permalink" href="./Win32API::File.html#WriteFile">#</a>WriteFile</dt>
<dd>

</dd>
<dt id="WriteFile(-$hFile,-$pBuffer,-$lBytes,-$ouBytesWritten,-$pOverlapped-)"><a class="permalink" href="./Win32API::File.html#WriteFile(-$hFile,-$pBuffer,-$lBytes,-$ouBytesWritten,-$pOverlapped-)">#</a><a id="WriteFile1"></a><a id="WriteFile-hFile-pBuffer-lBytes-ouBytesWritten-pOverlapped"></a><code>WriteFile( $hFile, $pBuffer, $lBytes, $ouBytesWritten, $pOverlapped )</code></dt>
<dd>

<p>Write bytes to a file or file-like device. Returns a true value if the operation was successful. For failure, returns a false value and sets <code>fileLastError()</code> and <code>$^E</code> for the reason for the failure.</p>

<p><code>$hFile</code> is a Win32 native file handle that is already open to the file or device to be written to.</p>

<p><code>$pBuffer</code> is a string containing the bytes to be written.</p>

<p><code>$lBytes</code> is the number of bytes you would like to write. If <code>$pBuffer</code> is not at least <code>$lBytes</code> long, <code>WriteFile</code> croaks. You can specify <code>0</code> for <code>$lBytes</code> to write <code>length($pBuffer)</code> bytes. A leading <code>&quot;=&quot;</code> on <code>$lBytes</code> will be silently ignored, even if Perl warnings are enabled.</p>

<p><code>$ouBytesWritten</code> will be set to the actual number of bytes written unless you specify it as <code>[]</code>.</p>

<p><code>$pOverlapped</code> is <code>[]</code> or is an <code>OVERLAPPED</code> structure packed into a string. This is only useful if <code>$hFile</code> was opened with the <code>FILE_FLAG_OVERLAPPED</code> flag set.</p>

</dd>
</dl>

</dd>
<dt id="&quot;:FuncA&quot;"><a class="permalink" href="./Win32API::File.html#%22:FuncA%22">#</a><a id="FuncA"></a><code>&quot;:FuncA&quot;</code></dt>
<dd>

<p>The ASCII-specific functions. Each of these is just the same as the version without the trailing &quot;A&quot;.</p>

<pre><code class="plaintext">CopyFileA
CreateFileA
DefineDosDeviceA
DeleteFileA
GetDriveTypeA
GetFileAttributesA
GetLogicalDriveStringsA
GetVolumeInformationA
MoveFileA
MoveFileExA
QueryDosDeviceA</code></pre>

</dd>
<dt id="&quot;:FuncW&quot;"><a class="permalink" href="./Win32API::File.html#%22:FuncW%22">#</a><a id="FuncW"></a><code>&quot;:FuncW&quot;</code></dt>
<dd>

<p>The wide-character-specific (Unicode) functions. Each of these is just the same as the version without the trailing &quot;W&quot; except that strings are expected in Unicode and some lengths are measured as number of <code>WCHAR</code>s instead of number of bytes, as indicated below.</p>

<dl>

<dt id="CopyFileW"><a class="permalink" href="./Win32API::File.html#CopyFileW">#</a>CopyFileW</dt>
<dd>

</dd>
<dt id="CopyFileW(-$swOldFileName,-$swNewFileName,-$bFailIfExists-)"><a class="permalink" href="./Win32API::File.html#CopyFileW(-$swOldFileName,-$swNewFileName,-$bFailIfExists-)">#</a><a id="CopyFileW1"></a><a id="CopyFileW-swOldFileName-swNewFileName-bFailIfExists"></a><code>CopyFileW( $swOldFileName, $swNewFileName, $bFailIfExists )</code></dt>
<dd>

<p><code>$swOldFileName</code> and <code>$swNewFileName</code> are Unicode strings.</p>

</dd>
<dt id="CreateFileW"><a class="permalink" href="./Win32API::File.html#CreateFileW">#</a>CreateFileW</dt>
<dd>

</dd>
<dt id="$hObject=-CreateFileW(-$swPath,-$uAccess,-$uShare,-$pSecAttr,-$uCreate,-$uFlags,-$hModel-)"><a class="permalink" href="./Win32API::File.html#$hObject=-CreateFileW(-$swPath,-$uAccess,-$uShare,-$pSecAttr,-$uCreate,-$uFlags,-$hModel-)">#</a><a id="hObject-CreateFileW-swPath-uAccess-uShare-pSecAttr-uCreate-uFlags-hModel"></a><code>$hObject= CreateFileW( $swPath, $uAccess, $uShare, $pSecAttr, $uCreate, $uFlags, $hModel )</code></dt>
<dd>

<p><code>$swPath</code> is Unicode.</p>

</dd>
<dt id="DefineDosDeviceW"><a class="permalink" href="./Win32API::File.html#DefineDosDeviceW">#</a>DefineDosDeviceW</dt>
<dd>

</dd>
<dt id="DefineDosDeviceW(-$uFlags,-$swDosDeviceName,-$swTargetPath-)"><a class="permalink" href="./Win32API::File.html#DefineDosDeviceW(-$uFlags,-$swDosDeviceName,-$swTargetPath-)">#</a><a id="DefineDosDeviceW1"></a><a id="DefineDosDeviceW-uFlags-swDosDeviceName-swTargetPath"></a><code>DefineDosDeviceW( $uFlags, $swDosDeviceName, $swTargetPath )</code></dt>
<dd>

<p><code>$swDosDeviceName</code> and <code>$swTargetPath</code> are Unicode.</p>

</dd>
<dt id="DeleteFileW"><a class="permalink" href="./Win32API::File.html#DeleteFileW">#</a>DeleteFileW</dt>
<dd>

</dd>
<dt id="DeleteFileW(-$swFileName-)"><a class="permalink" href="./Win32API::File.html#DeleteFileW(-$swFileName-)">#</a><a id="DeleteFileW1"></a><a id="DeleteFileW-swFileName"></a><code>DeleteFileW( $swFileName )</code></dt>
<dd>

<p><code>$swFileName</code> is Unicode.</p>

</dd>
<dt id="GetDriveTypeW"><a class="permalink" href="./Win32API::File.html#GetDriveTypeW">#</a>GetDriveTypeW</dt>
<dd>

</dd>
<dt id="$uDriveType=-GetDriveTypeW(-$swRootPath-)"><a class="permalink" href="./Win32API::File.html#$uDriveType=-GetDriveTypeW(-$swRootPath-)">#</a><a id="uDriveType-GetDriveTypeW-swRootPath"></a><code>$uDriveType= GetDriveTypeW( $swRootPath )</code></dt>
<dd>

<p><code>$swRootPath</code> is Unicode.</p>

</dd>
<dt id="GetFileAttributesW"><a class="permalink" href="./Win32API::File.html#GetFileAttributesW">#</a>GetFileAttributesW</dt>
<dd>

</dd>
<dt id="$uAttrs=-GetFileAttributesW(-$swPath-)"><a class="permalink" href="./Win32API::File.html#$uAttrs=-GetFileAttributesW(-$swPath-)">#</a><a id="uAttrs-GetFileAttributesW-swPath"></a><code>$uAttrs= GetFileAttributesW( $swPath )</code></dt>
<dd>

<p><code>$swPath</code> is Unicode.</p>

</dd>
<dt id="GetLogicalDriveStringsW"><a class="permalink" href="./Win32API::File.html#GetLogicalDriveStringsW">#</a>GetLogicalDriveStringsW</dt>
<dd>

</dd>
<dt id="$olwOutLength=-GetLogicalDriveStringsW(-$lwBufSize,-$oswBuffer-)"><a class="permalink" href="./Win32API::File.html#$olwOutLength=-GetLogicalDriveStringsW(-$lwBufSize,-$oswBuffer-)">#</a><a id="olwOutLength-GetLogicalDriveStringsW-lwBufSize-oswBuffer"></a><code>$olwOutLength= GetLogicalDriveStringsW( $lwBufSize, $oswBuffer )</code></dt>
<dd>

<p>Unicode is stored in <code>$oswBuffer</code>. <code>$lwBufSize</code> and <code>$olwOutLength</code> are measured as number of <code>WCHAR</code>s.</p>

</dd>
<dt id="GetVolumeInformationW"><a class="permalink" href="./Win32API::File.html#GetVolumeInformationW">#</a>GetVolumeInformationW</dt>
<dd>

</dd>
<dt id="GetVolumeInformationW(-$swRootPath,-$oswVolName,-$lwVolName,-$ouSerialNum,-$ouMaxNameLen,-$ouFsFlags,-$oswFsType,-$lwFsType-)"><a class="permalink" href="./Win32API::File.html#GetVolumeInformationW(-$swRootPath,-$oswVolName,-$lwVolName,-$ouSerialNum,-$ouMaxNameLen,-$ouFsFlags,-$oswFsType,-$lwFsType-)">#</a><a id="GetVolumeInformationW1"></a><a id="GetVolumeInformationW-swRootPath-oswVolName-lwVolName-ouSerialNum-ouMaxNameLen-ouFsFlags-oswFsType-lwFsType"></a><code>GetVolumeInformationW( $swRootPath, $oswVolName, $lwVolName, $ouSerialNum, $ouMaxNameLen, $ouFsFlags, $oswFsType, $lwFsType )</code></dt>
<dd>

<p><code>$swRootPath</code> is Unicode and Unicode is written to <code>$oswVolName</code> and <code>$oswFsType</code>. <code>$lwVolName</code> and <code>$lwFsType</code> are measures as number of <code>WCHAR</code>s.</p>

</dd>
<dt id="MoveFileW"><a class="permalink" href="./Win32API::File.html#MoveFileW">#</a>MoveFileW</dt>
<dd>

</dd>
<dt id="MoveFileW(-$swOldName,-$swNewName-)"><a class="permalink" href="./Win32API::File.html#MoveFileW(-$swOldName,-$swNewName-)">#</a><a id="MoveFileW1"></a><a id="MoveFileW-swOldName-swNewName"></a><code>MoveFileW( $swOldName, $swNewName )</code></dt>
<dd>

<p><code>$swOldName</code> and <code>$swNewName</code> are Unicode.</p>

</dd>
<dt id="MoveFileExW"><a class="permalink" href="./Win32API::File.html#MoveFileExW">#</a>MoveFileExW</dt>
<dd>

</dd>
<dt id="MoveFileExW(-$swOldName,-$swNewName,-$uFlags-)"><a class="permalink" href="./Win32API::File.html#MoveFileExW(-$swOldName,-$swNewName,-$uFlags-)">#</a><a id="MoveFileExW1"></a><a id="MoveFileExW-swOldName-swNewName-uFlags"></a><code>MoveFileExW( $swOldName, $swNewName, $uFlags )</code></dt>
<dd>

<p><code>$swOldName</code> and <code>$swNewName</code> are Unicode.</p>

</dd>
<dt id="QueryDosDeviceW"><a class="permalink" href="./Win32API::File.html#QueryDosDeviceW">#</a>QueryDosDeviceW</dt>
<dd>

</dd>
<dt id="$olwTargetLen=-QueryDosDeviceW(-$swDeviceName,-$oswTargetPath,-$lwTargetBuf-)"><a class="permalink" href="./Win32API::File.html#$olwTargetLen=-QueryDosDeviceW(-$swDeviceName,-$oswTargetPath,-$lwTargetBuf-)">#</a><a id="olwTargetLen-QueryDosDeviceW-swDeviceName-oswTargetPath-lwTargetBuf"></a><code>$olwTargetLen= QueryDosDeviceW( $swDeviceName, $oswTargetPath, $lwTargetBuf )</code></dt>
<dd>

<p><code>$swDeviceName</code> is Unicode and Unicode is written to <code>$oswTargetPath</code>. <code>$lwTargetBuf</code> and <code>$olwTargetLen</code> are measured as number of <code>WCHAR</code>s.</p>

</dd>
</dl>

</dd>
<dt id="&quot;:Misc&quot;"><a class="permalink" href="./Win32API::File.html#%22:Misc%22">#</a><a id="Misc"></a><code>&quot;:Misc&quot;</code></dt>
<dd>

<p>Miscellaneous constants. Used for the <code>$uCreate</code> argument of <code>CreateFile</code> or the <code>$uFromWhere</code> argument of <code>SetFilePointer</code>. Plus <code>INVALID_HANDLE_VALUE</code>, which you usually won&#39;t need to check for since most routines translate it into a false value.</p>

<pre><code class="plaintext">CREATE_ALWAYS		CREATE_NEW		OPEN_ALWAYS
OPEN_EXISTING		TRUNCATE_EXISTING	INVALID_HANDLE_VALUE
FILE_BEGIN		FILE_CURRENT		FILE_END</code></pre>

</dd>
<dt id="&quot;:DDD_&quot;"><a class="permalink" href="./Win32API::File.html#%22:DDD_%22">#</a><a id="DDD_"></a><code>&quot;:DDD_&quot;</code></dt>
<dd>

<p>Constants for the <code>$uFlags</code> argument of <code>DefineDosDevice</code>.</p>

<pre><code class="plaintext">DDD_EXACT_MATCH_ON_REMOVE
DDD_RAW_TARGET_PATH
DDD_REMOVE_DEFINITION</code></pre>

</dd>
<dt id="&quot;:DRIVE_&quot;"><a class="permalink" href="./Win32API::File.html#%22:DRIVE_%22">#</a><a id="DRIVE_"></a><code>&quot;:DRIVE_&quot;</code></dt>
<dd>

<p>Constants returned by <code>GetDriveType</code>.</p>

<pre><code class="plaintext">DRIVE_UNKNOWN		DRIVE_NO_ROOT_DIR	DRIVE_REMOVABLE
DRIVE_FIXED		DRIVE_REMOTE		DRIVE_CDROM
DRIVE_RAMDISK</code></pre>

</dd>
<dt id="&quot;:FILE_&quot;"><a class="permalink" href="./Win32API::File.html#%22:FILE_%22">#</a><a id="FILE_"></a><code>&quot;:FILE_&quot;</code></dt>
<dd>

<p>Specific types of access to files that can be requested via the <code>$uAccess</code> argument to <code>CreateFile</code>.</p>

<pre><code class="plaintext">FILE_READ_DATA			FILE_LIST_DIRECTORY
FILE_WRITE_DATA			FILE_ADD_FILE
FILE_APPEND_DATA		FILE_ADD_SUBDIRECTORY
FILE_CREATE_PIPE_INSTANCE	FILE_READ_EA
FILE_WRITE_EA			FILE_EXECUTE
FILE_TRAVERSE			FILE_DELETE_CHILD
FILE_READ_ATTRIBUTES		FILE_WRITE_ATTRIBUTES
FILE_ALL_ACCESS			FILE_GENERIC_READ
FILE_GENERIC_WRITE		FILE_GENERIC_EXECUTE )],</code></pre>

</dd>
<dt id="&quot;:FILE_ATTRIBUTE_&quot;"><a class="permalink" href="./Win32API::File.html#%22:FILE_ATTRIBUTE_%22">#</a><a id="FILE_ATTRIBUTE_"></a><code>&quot;:FILE_ATTRIBUTE_&quot;</code></dt>
<dd>

<p>File attribute constants. Returned by <code>attrLetsToBits</code> and used in the <code>$uFlags</code> argument to <code>CreateFile</code>.</p>

<pre><code class="plaintext">FILE_ATTRIBUTE_ARCHIVE			FILE_ATTRIBUTE_COMPRESSED
FILE_ATTRIBUTE_HIDDEN			FILE_ATTRIBUTE_NORMAL
FILE_ATTRIBUTE_OFFLINE			FILE_ATTRIBUTE_READONLY
FILE_ATTRIBUTE_SYSTEM			FILE_ATTRIBUTE_TEMPORARY</code></pre>

<p>In addition, <code>GetFileAttributes</code> can return these constants (or INVALID_FILE_ATTRIBUTES in case of an error).</p>

<pre><code class="plaintext">FILE_ATTRIBUTE_DEVICE			FILE_ATTRIBUTE_DIRECTORY
FILE_ATTRIBUTE_ENCRYPTED		FILE_ATTRIBUTE_NOT_CONTENT_INDEXED
FILE_ATTRIBUTE_REPARSE_POINT	FILE_ATTRIBUTE_SPARSE_FILE</code></pre>

</dd>
<dt id="&quot;:FILE_FLAG_&quot;"><a class="permalink" href="./Win32API::File.html#%22:FILE_FLAG_%22">#</a><a id="FILE_FLAG_"></a><code>&quot;:FILE_FLAG_&quot;</code></dt>
<dd>

<p>File option flag constants. Used in the <code>$uFlags</code> argument to <code>CreateFile</code>.</p>

<pre><code class="plaintext">FILE_FLAG_BACKUP_SEMANTICS	FILE_FLAG_DELETE_ON_CLOSE
FILE_FLAG_NO_BUFFERING		FILE_FLAG_OVERLAPPED
FILE_FLAG_POSIX_SEMANTICS	FILE_FLAG_RANDOM_ACCESS
FILE_FLAG_SEQUENTIAL_SCAN	FILE_FLAG_WRITE_THROUGH
FILE_FLAG_OPEN_REPARSE_POINT</code></pre>

</dd>
<dt id="&quot;:FILE_SHARE_&quot;"><a class="permalink" href="./Win32API::File.html#%22:FILE_SHARE_%22">#</a><a id="FILE_SHARE_"></a><code>&quot;:FILE_SHARE_&quot;</code></dt>
<dd>

<p>File sharing constants. Used in the <code>$uShare</code> argument to <code>CreateFile</code>.</p>

<pre><code class="plaintext">FILE_SHARE_DELETE	FILE_SHARE_READ		FILE_SHARE_WRITE</code></pre>

</dd>
<dt id="&quot;:FILE_TYPE_&quot;"><a class="permalink" href="./Win32API::File.html#%22:FILE_TYPE_%22">#</a><a id="FILE_TYPE_"></a><code>&quot;:FILE_TYPE_&quot;</code></dt>
<dd>

<p>File type constants. Returned by <code>GetFileType</code>.</p>

<pre><code class="plaintext">FILE_TYPE_CHAR		FILE_TYPE_DISK
FILE_TYPE_PIPE		FILE_TYPE_UNKNOWN</code></pre>

</dd>
<dt id="&quot;:FS_&quot;"><a class="permalink" href="./Win32API::File.html#%22:FS_%22">#</a><a id="FS_"></a><code>&quot;:FS_&quot;</code></dt>
<dd>

<p>File system characteristics constants. Placed in the <code>$ouFsFlags</code> argument to <code>GetVolumeInformation</code>.</p>

<pre><code class="plaintext">FS_CASE_IS_PRESERVED		FS_CASE_SENSITIVE
FS_UNICODE_STORED_ON_DISK	FS_PERSISTENT_ACLS 
FS_FILE_COMPRESSION		FS_VOL_IS_COMPRESSED</code></pre>

</dd>
<dt id="&quot;:HANDLE_FLAG_&quot;"><a class="permalink" href="./Win32API::File.html#%22:HANDLE_FLAG_%22">#</a><a id="HANDLE_FLAG_"></a><code>&quot;:HANDLE_FLAG_&quot;</code></dt>
<dd>

<p>Flag bits modifying the behavior of an object handle and accessed via <code>GetHandleInformation</code> and <code>SetHandleInformation</code>.</p>

<dl>

<dt id="HANDLE_FLAG_INHERIT"><a class="permalink" href="./Win32API::File.html#HANDLE_FLAG_INHERIT">#</a>HANDLE_FLAG_INHERIT</dt>
<dd>

<p>If this bit is set, then children of this process who inherit handles [that is, processes created by calls to the Win32 <code>CreateProcess</code> API with the <code>bInheritHandles</code> parameter specified as <code>TRUE</code>], will inherit this particular object handle.</p>

</dd>
<dt id="HANDLE_FLAG_PROTECT_FROM_CLOSE"><a class="permalink" href="./Win32API::File.html#HANDLE_FLAG_PROTECT_FROM_CLOSE">#</a>HANDLE_FLAG_PROTECT_FROM_CLOSE</dt>
<dd>

<p>If this bit is set, then calls to <code>CloseHandle</code> against this handle will be ignored, leaving the handle open and usable.</p>

</dd>
</dl>

</dd>
<dt id="&quot;:IOCTL_STORAGE_&quot;"><a class="permalink" href="./Win32API::File.html#%22:IOCTL_STORAGE_%22">#</a><a id="IOCTL_STORAGE_"></a><code>&quot;:IOCTL_STORAGE_&quot;</code></dt>
<dd>

<p>I/O control operations for generic storage devices. Used in the <code>$uIoControlCode</code> argument to <code>DeviceIoControl</code>. Includes <code>IOCTL_STORAGE_CHECK_VERIFY</code>, <code>IOCTL_STORAGE_MEDIA_REMOVAL</code>, <code>IOCTL_STORAGE_EJECT_MEDIA</code>, <code>IOCTL_STORAGE_LOAD_MEDIA</code>, <code>IOCTL_STORAGE_RESERVE</code>, <code>IOCTL_STORAGE_RELEASE</code>, <code>IOCTL_STORAGE_FIND_NEW_DEVICES</code>, and <code>IOCTL_STORAGE_GET_MEDIA_TYPES</code>.</p>

<dl>

<dt id="IOCTL_STORAGE_CHECK_VERIFY"><a class="permalink" href="./Win32API::File.html#IOCTL_STORAGE_CHECK_VERIFY">#</a><code>IOCTL_STORAGE_CHECK_VERIFY</code></dt>
<dd>

<p>Verify that a device&#39;s media is accessible. <code>$pInBuf</code> and <code>$opOutBuf</code> should both be <code>[]</code>. If <code>DeviceIoControl</code> returns a true value, then the media is currently accessible.</p>

</dd>
<dt id="IOCTL_STORAGE_MEDIA_REMOVAL"><a class="permalink" href="./Win32API::File.html#IOCTL_STORAGE_MEDIA_REMOVAL">#</a><code>IOCTL_STORAGE_MEDIA_REMOVAL</code></dt>
<dd>

<p>Allows the device&#39;s media to be locked or unlocked. <code>$opOutBuf</code> should be <code>[]</code>. <code>$pInBuf</code> should be a <code>PREVENT_MEDIA_REMOVAL</code> data structure, which is simply an integer containing a boolean value:</p>

<pre><code>$pInBuf= pack( &quot;i&quot;, $bPreventMediaRemoval );</code></pre>

</dd>
<dt id="IOCTL_STORAGE_EJECT_MEDIA"><a class="permalink" href="./Win32API::File.html#IOCTL_STORAGE_EJECT_MEDIA">#</a><code>IOCTL_STORAGE_EJECT_MEDIA</code></dt>
<dd>

<p>Requests that the device eject the media. <code>$pInBuf</code> and <code>$opOutBuf</code> should both be <code>[]</code>.</p>

</dd>
<dt id="IOCTL_STORAGE_LOAD_MEDIA"><a class="permalink" href="./Win32API::File.html#IOCTL_STORAGE_LOAD_MEDIA">#</a><code>IOCTL_STORAGE_LOAD_MEDIA</code></dt>
<dd>

<p>Requests that the device load the media. <code>$pInBuf</code> and <code>$opOutBuf</code> should both be <code>[]</code>.</p>

</dd>
<dt id="IOCTL_STORAGE_RESERVE"><a class="permalink" href="./Win32API::File.html#IOCTL_STORAGE_RESERVE">#</a><code>IOCTL_STORAGE_RESERVE</code></dt>
<dd>

<p>Requests that the device be reserved. <code>$pInBuf</code> and <code>$opOutBuf</code> should both be <code>[]</code>.</p>

</dd>
<dt id="IOCTL_STORAGE_RELEASE"><a class="permalink" href="./Win32API::File.html#IOCTL_STORAGE_RELEASE">#</a><code>IOCTL_STORAGE_RELEASE</code></dt>
<dd>

<p>Releases a previous device reservation. <code>$pInBuf</code> and <code>$opOutBuf</code> should both be <code>[]</code>.</p>

</dd>
<dt id="IOCTL_STORAGE_FIND_NEW_DEVICES"><a class="permalink" href="./Win32API::File.html#IOCTL_STORAGE_FIND_NEW_DEVICES">#</a><code>IOCTL_STORAGE_FIND_NEW_DEVICES</code></dt>
<dd>

<p>No documentation on this IOCTL operation was found.</p>

</dd>
<dt id="IOCTL_STORAGE_GET_MEDIA_TYPES"><a class="permalink" href="./Win32API::File.html#IOCTL_STORAGE_GET_MEDIA_TYPES">#</a><code>IOCTL_STORAGE_GET_MEDIA_TYPES</code></dt>
<dd>

<p>Requests information about the type of media supported by the device. <code>$pInBuf</code> should be <code>[]</code>. <code>$opOutBuf</code> will be set to contain a vector of <code>DISK_GEOMETRY</code> data structures, which can be decoded via:</p>

<pre><code>    # Calculate the number of DISK_GEOMETRY structures returned:
    my $cStructs= length($opOutBuf)/(4+4+4+4+4+4);
    my @fields= unpack( &quot;L l I L L L&quot; x $cStructs, $opOutBuf )
    my( @ucCylsLow, @ivcCylsHigh, @uMediaType, @uTracksPerCyl,
      @uSectsPerTrack, @uBytesPerSect )= ();
    while(  @fields  ) {
	push( @ucCylsLow, unshift @fields );
	push( @ivcCylsHigh, unshift @fields );
	push( @uMediaType, unshift @fields );
	push( @uTracksPerCyl, unshift @fields );
	push( @uSectsPerTrack, unshift @fields );
	push( @uBytesPerSect, unshift @fields );
    }</code></pre>

<p>For the <code>$i</code>th type of supported media, the following variables will contain the following data.</p>

<dl>

<dt id="$ucCylsLow[$i]"><a class="permalink" href="./Win32API::File.html#$ucCylsLow%5B$i%5D">#</a><a id="ucCylsLow-i"></a><code>$ucCylsLow[$i]</code></dt>
<dd>

<p>The low-order 4 bytes of the total number of cylinders.</p>

</dd>
<dt id="$ivcCylsHigh[$i]"><a class="permalink" href="./Win32API::File.html#$ivcCylsHigh%5B$i%5D">#</a><a id="ivcCylsHigh-i"></a><code>$ivcCylsHigh[$i]</code></dt>
<dd>

<p>The high-order 4 bytes of the total number of cylinders.</p>

</dd>
<dt id="$uMediaType[$i]"><a class="permalink" href="./Win32API::File.html#$uMediaType%5B$i%5D">#</a><a id="uMediaType-i"></a><code>$uMediaType[$i]</code></dt>
<dd>

<p>A code for the type of media. See the <code>&quot;:MEDIA_TYPE&quot;</code> export class.</p>

</dd>
<dt id="$uTracksPerCyl[$i]"><a class="permalink" href="./Win32API::File.html#$uTracksPerCyl%5B$i%5D">#</a><a id="uTracksPerCyl-i"></a><code>$uTracksPerCyl[$i]</code></dt>
<dd>

<p>The number of tracks in each cylinder.</p>

</dd>
<dt id="$uSectsPerTrack[$i]"><a class="permalink" href="./Win32API::File.html#$uSectsPerTrack%5B$i%5D">#</a><a id="uSectsPerTrack-i"></a><code>$uSectsPerTrack[$i]</code></dt>
<dd>

<p>The number of sectors in each track.</p>

</dd>
<dt id="$uBytesPerSect[$i]"><a class="permalink" href="./Win32API::File.html#$uBytesPerSect%5B$i%5D">#</a><a id="uBytesPerSect-i"></a><code>$uBytesPerSect[$i]</code></dt>
<dd>

<p>The number of bytes in each sector.</p>

</dd>
</dl>

</dd>
</dl>

</dd>
<dt id="&quot;:IOCTL_DISK_&quot;"><a class="permalink" href="./Win32API::File.html#%22:IOCTL_DISK_%22">#</a><a id="IOCTL_DISK_"></a><code>&quot;:IOCTL_DISK_&quot;</code></dt>
<dd>

<p>I/O control operations for disk devices. Used in the <code>$uIoControlCode</code> argument to <code>DeviceIoControl</code>. Most of these are to be used on physical drive devices like <code>&quot;//./PhysicalDrive0&quot;</code>. However, <code>IOCTL_DISK_GET_PARTITION_INFO</code> and <code>IOCTL_DISK_SET_PARTITION_INFO</code> should only be used on a single-partition device like <code>&quot;//./C:&quot;</code>. Also, <code>IOCTL_DISK_GET_MEDIA_TYPES</code> is documented as having been superseded but is still useful when used on a floppy device like <code>&quot;//./A:&quot;</code>.</p>

<p>Includes <code>IOCTL_DISK_FORMAT_TRACKS</code>, <code>IOCTL_DISK_FORMAT_TRACKS_EX</code>, <code>IOCTL_DISK_GET_DRIVE_GEOMETRY</code>, <code>IOCTL_DISK_GET_DRIVE_LAYOUT</code>, <code>IOCTL_DISK_GET_MEDIA_TYPES</code>, <code>IOCTL_DISK_GET_PARTITION_INFO</code>, <code>IOCTL_DISK_HISTOGRAM_DATA</code>, <code>IOCTL_DISK_HISTOGRAM_RESET</code>, <code>IOCTL_DISK_HISTOGRAM_STRUCTURE</code>, <code>IOCTL_DISK_IS_WRITABLE</code>, <code>IOCTL_DISK_LOGGING</code>, <code>IOCTL_DISK_PERFORMANCE</code>, <code>IOCTL_DISK_REASSIGN_BLOCKS</code>, <code>IOCTL_DISK_REQUEST_DATA</code>, <code>IOCTL_DISK_REQUEST_STRUCTURE</code>, <code>IOCTL_DISK_SET_DRIVE_LAYOUT</code>, <code>IOCTL_DISK_SET_PARTITION_INFO</code>, and <code>IOCTL_DISK_VERIFY</code>.</p>

<dl>

<dt id="IOCTL_DISK_GET_DRIVE_GEOMETRY"><a class="permalink" href="./Win32API::File.html#IOCTL_DISK_GET_DRIVE_GEOMETRY">#</a><code>IOCTL_DISK_GET_DRIVE_GEOMETRY</code></dt>
<dd>

<p>Request information about the size and geometry of the disk. <code>$pInBuf</code> should be <code>[]</code>. <code>$opOutBuf</code> will be set to a <code>DISK_GEOMETRY</code> data structure which can be decode via:</p>

<pre><code>( $ucCylsLow, $ivcCylsHigh, $uMediaType, $uTracksPerCyl,
  $uSectsPerTrack, $uBytesPerSect )= unpack( &quot;L l I L L L&quot;, $opOutBuf );</code></pre>

<dl>

<dt id="$ucCylsLow"><a class="permalink" href="./Win32API::File.html#$ucCylsLow">#</a><a id="ucCylsLow"></a><code>$ucCylsLow</code></dt>
<dd>

<p>The low-order 4 bytes of the total number of cylinders.</p>

</dd>
<dt id="$ivcCylsHigh"><a class="permalink" href="./Win32API::File.html#$ivcCylsHigh">#</a><a id="ivcCylsHigh"></a><code>$ivcCylsHigh</code></dt>
<dd>

<p>The high-order 4 bytes of the total number of cylinders.</p>

</dd>
<dt id="$uMediaType"><a class="permalink" href="./Win32API::File.html#$uMediaType">#</a><a id="uMediaType"></a><code>$uMediaType</code></dt>
<dd>

<p>A code for the type of media. See the <code>&quot;:MEDIA_TYPE&quot;</code> export class.</p>

</dd>
<dt id="$uTracksPerCyl"><a class="permalink" href="./Win32API::File.html#$uTracksPerCyl">#</a><a id="uTracksPerCyl"></a><code>$uTracksPerCyl</code></dt>
<dd>

<p>The number of tracks in each cylinder.</p>

</dd>
<dt id="$uSectsPerTrack"><a class="permalink" href="./Win32API::File.html#$uSectsPerTrack">#</a><a id="uSectsPerTrack"></a><code>$uSectsPerTrack</code></dt>
<dd>

<p>The number of sectors in each track.</p>

</dd>
<dt id="$uBytesPerSect"><a class="permalink" href="./Win32API::File.html#$uBytesPerSect">#</a><a id="uBytesPerSect"></a><code>$uBytesPerSect</code></dt>
<dd>

<p>The number of bytes in each sector.</p>

</dd>
</dl>

</dd>
<dt id="IOCTL_DISK_GET_PARTITION_INFO"><a class="permalink" href="./Win32API::File.html#IOCTL_DISK_GET_PARTITION_INFO">#</a><code>IOCTL_DISK_GET_PARTITION_INFO</code></dt>
<dd>

<p>Request information about the size and geometry of the partition. <code>$pInBuf</code> should be <code>[]</code>. <code>$opOutBuf</code> will be set to a <code>PARTITION_INFORMATION</code> data structure which can be decode via:</p>

<pre><code>( $uStartLow, $ivStartHigh, $ucHiddenSects, $uPartitionSeqNumber,
  $uPartitionType, $bActive, $bRecognized, $bToRewrite )=
  unpack( &quot;L l L L C c c c&quot;, $opOutBuf );</code></pre>

<dl>

<dt id="$uStartLow-and-$ivStartHigh"><a class="permalink" href="./Win32API::File.html#$uStartLow-and-$ivStartHigh">#</a><a id="uStartLow-and-ivStartHigh"></a><code>$uStartLow</code> and <code>$ivStartHigh</code></dt>
<dd>

<p>The low-order and high-order [respectively] 4 bytes of the starting offset of the partition, measured in bytes.</p>

</dd>
<dt id="$ucHiddenSects"><a class="permalink" href="./Win32API::File.html#$ucHiddenSects">#</a><a id="ucHiddenSects"></a><code>$ucHiddenSects</code></dt>
<dd>

<p>The number of &quot;hidden&quot; sectors for this partition. Actually this is the number of sectors found prior to this partition, that is, the starting offset [as found in <code>$uStartLow</code> and <code>$ivStartHigh</code>] divided by the number of bytes per sector.</p>

</dd>
<dt id="$uPartitionSeqNumber"><a class="permalink" href="./Win32API::File.html#$uPartitionSeqNumber">#</a><a id="uPartitionSeqNumber"></a><code>$uPartitionSeqNumber</code></dt>
<dd>

<p>The sequence number of this partition. Partitions are numbered starting as <code>1</code> [with &quot;partition 0&quot; meaning the entire disk]. Sometimes this field may be <code>0</code> and you&#39;ll have to infer the partition sequence number from how many partitions precede it on the disk.</p>

</dd>
<dt id="$uPartitionType"><a class="permalink" href="./Win32API::File.html#$uPartitionType">#</a><a id="uPartitionType"></a><code>$uPartitionType</code></dt>
<dd>

<p>The type of partition. See the <code>&quot;:PARTITION_&quot;</code> export class for a list of known types. See also <code>IsRecognizedPartition</code> and <code>IsContainerPartition</code>.</p>

</dd>
<dt id="$bActive"><a class="permalink" href="./Win32API::File.html#$bActive">#</a><a id="bActive"></a><code>$bActive</code></dt>
<dd>

<p><code>1</code> for the active [boot] partition, <code>0</code> otherwise.</p>

</dd>
<dt id="$bRecognized"><a class="permalink" href="./Win32API::File.html#$bRecognized">#</a><a id="bRecognized"></a><code>$bRecognized</code></dt>
<dd>

<p>Whether this type of partition is support under Win32.</p>

</dd>
<dt id="$bToRewrite"><a class="permalink" href="./Win32API::File.html#$bToRewrite">#</a><a id="bToRewrite"></a><code>$bToRewrite</code></dt>
<dd>

<p>Whether to update this partition information. This field is not used by <code>IOCTL_DISK_GET_PARTITION_INFO</code>. For <code>IOCTL_DISK_SET_DRIVE_LAYOUT</code>, you must set this field to a true value for any partitions you wish to have changed, added, or deleted.</p>

</dd>
</dl>

</dd>
<dt id="IOCTL_DISK_SET_PARTITION_INFO"><a class="permalink" href="./Win32API::File.html#IOCTL_DISK_SET_PARTITION_INFO">#</a><code>IOCTL_DISK_SET_PARTITION_INFO</code></dt>
<dd>

<p>Change the type of the partition. <code>$opOutBuf</code> should be <code>[]</code>. <code>$pInBuf</code> should be a <code>SET_PARTITION_INFORMATION</code> data structure which is just a single byte containing the new partition type [see the <code>&quot;:PARTITION_&quot;</code> export class for a list of known types]:</p>

<pre><code>$pInBuf= pack( &quot;C&quot;, $uPartitionType );</code></pre>

</dd>
<dt id="IOCTL_DISK_GET_DRIVE_LAYOUT"><a class="permalink" href="./Win32API::File.html#IOCTL_DISK_GET_DRIVE_LAYOUT">#</a><code>IOCTL_DISK_GET_DRIVE_LAYOUT</code></dt>
<dd>

<p>Request information about the disk layout. <code>$pInBuf</code> should be <code>[]</code>. <code>$opOutBuf</code> will be set to contain <code>DRIVE_LAYOUT_INFORMATION</code> structure including several <code>PARTITION_INFORMATION</code> structures:</p>

<pre><code>    my( $cPartitions, $uDiskSignature )= unpack( &quot;L L&quot;, $opOutBuf );
    my @fields= unpack( &quot;x8&quot; . ( &quot;L l L L C c c c&quot; x $cPartitions ),
		        $opOutBuf );
    my( @uStartLow, @ivStartHigh, @ucHiddenSects,
      @uPartitionSeqNumber, @uPartitionType, @bActive,
      @bRecognized, @bToRewrite )= ();
    for(  1..$cPartition  ) {
	push( @uStartLow, unshift @fields );
	push( @ivStartHigh, unshift @fields );
	push( @ucHiddenSects, unshift @fields );
	push( @uPartitionSeqNumber, unshift @fields );
	push( @uPartitionType, unshift @fields );
	push( @bActive, unshift @fields );
	push( @bRecognized, unshift @fields );
	push( @bToRewrite, unshift @fields );
    }</code></pre>

<dl>

<dt id="$cPartitions"><a class="permalink" href="./Win32API::File.html#$cPartitions">#</a><a id="cPartitions"></a><code>$cPartitions</code></dt>
<dd>

<p>If the number of partitions on the disk.</p>

</dd>
<dt id="$uDiskSignature"><a class="permalink" href="./Win32API::File.html#$uDiskSignature">#</a><a id="uDiskSignature"></a><code>$uDiskSignature</code></dt>
<dd>

<p>Is the disk signature, a unique number assigned by Disk Administrator [<i>WinDisk.exe</i>] and used to identify the disk. This allows drive letters for partitions on that disk to remain constant even if the SCSI Target ID of the disk gets changed.</p>

</dd>
</dl>

<p>See <code>IOCTL_DISK_GET_PARTITION_INFORMATION</code> for information on the remaining these fields.</p>

</dd>
<dt id="IOCTL_DISK_GET_MEDIA_TYPES"><a class="permalink" href="./Win32API::File.html#IOCTL_DISK_GET_MEDIA_TYPES">#</a><code>IOCTL_DISK_GET_MEDIA_TYPES</code></dt>
<dd>

<p>Is supposed to be superseded by <code>IOCTL_STORAGE_GET_MEDIA_TYPES</code> but is still useful for determining the types of floppy diskette formats that can be produced by a given floppy drive. See <i>ex/FormatFloppy.plx</i> for an example.</p>

</dd>
<dt id="IOCTL_DISK_SET_DRIVE_LAYOUT"><a class="permalink" href="./Win32API::File.html#IOCTL_DISK_SET_DRIVE_LAYOUT">#</a><code>IOCTL_DISK_SET_DRIVE_LAYOUT</code></dt>
<dd>

<p>Change the partition layout of the disk. <code>$pOutBuf</code> should be <code>[]</code>. <code>$pInBuf</code> should be a <code>DISK_LAYOUT_INFORMATION</code> data structure including several <code>PARTITION_INFORMATION</code> data structures.</p>

<pre><code>    # Already set:  $cPartitions, $uDiskSignature, @uStartLow, @ivStartHigh,
    #   @ucHiddenSects, @uPartitionSeqNumber, @uPartitionType, @bActive,
    #   @bRecognized, and @bToRewrite.
    my( @fields, $prtn )= ();
    for $prtn (  1..$cPartition  ) {
	push( @fields, $uStartLow[$prtn-1], $ivStartHigh[$prtn-1],
	    $ucHiddenSects[$prtn-1], $uPartitionSeqNumber[$prtn-1],
	    $uPartitionType[$prtn-1], $bActive[$prtn-1],
	    $bRecognized[$prtn-1], $bToRewrite[$prtn-1] );
    }
    $pInBuf= pack( &quot;L L&quot; . ( &quot;L l L L C c c c&quot; x $cPartitions ),
		   $cPartitions, $uDiskSignature, @fields );</code></pre>

<p>To delete a partition, zero out all fields except for <code>$bToRewrite</code> which should be set to <code>1</code>. To add a partition, increment <code>$cPartitions</code> and add the information for the new partition into the arrays, making sure that you insert <code>1</code> into @bToRewrite.</p>

<p>See <code>IOCTL_DISK_GET_DRIVE_LAYOUT</code> and <code>IOCTL_DISK_GET_PARITITON_INFORMATION</code> for descriptions of the fields.</p>

</dd>
<dt id="IOCTL_DISK_VERIFY"><a class="permalink" href="./Win32API::File.html#IOCTL_DISK_VERIFY">#</a><code>IOCTL_DISK_VERIFY</code></dt>
<dd>

<p>Performs a logical format of [part of] the disk. <code>$opOutBuf</code> should be <code>[]</code>. <code>$pInBuf</code> should contain a <code>VERIFY_INFORMATION</code> data structure:</p>

<pre><code>    $pInBuf= pack( &quot;L l L&quot;,
		   $uStartOffsetLow, $ivStartOffsetHigh, $uLength );</code></pre>

<dl>

<dt id="$uStartOffsetLow-and-$ivStartOffsetHigh"><a class="permalink" href="./Win32API::File.html#$uStartOffsetLow-and-$ivStartOffsetHigh">#</a><a id="uStartOffsetLow-and-ivStartOffsetHigh"></a><code>$uStartOffsetLow</code> and <code>$ivStartOffsetHigh</code></dt>
<dd>

<p>The low-order and high-order [respectively] 4 bytes of the offset [in bytes] where the formatting should begin.</p>

</dd>
<dt id="$uLength"><a class="permalink" href="./Win32API::File.html#$uLength">#</a><a id="uLength"></a><code>$uLength</code></dt>
<dd>

<p>The length [in bytes] of the section to be formatted.</p>

</dd>
</dl>

</dd>
<dt id="IOCTL_DISK_FORMAT_TRACKS"><a class="permalink" href="./Win32API::File.html#IOCTL_DISK_FORMAT_TRACKS">#</a><code>IOCTL_DISK_FORMAT_TRACKS</code></dt>
<dd>

<p>Format a range of tracks on the disk. <code>$opOutBuf</code> should be <code>[]</code>. <code>$pInBuf</code> should contain a <code>FORMAT_PARAMETERS</code> data structure:</p>

<pre><code>    $pInBuf= pack( &quot;L L L L L&quot;, $uMediaType,
		   $uStartCyl, $uEndCyl, $uStartHead, $uEndHead );</code></pre>

<p><code>$uMediaType</code> if the type of media to be formatted. Mostly used to specify the density to use when formatting a floppy diskette. See the <code>&quot;:MEDIA_TYPE&quot;</code> export class for more information.</p>

<p>The remaining fields specify the starting and ending cylinder and head of the range of tracks to be formatted.</p>

</dd>
<dt id="IOCTL_DISK_REASSIGN_BLOCKS"><a class="permalink" href="./Win32API::File.html#IOCTL_DISK_REASSIGN_BLOCKS">#</a><code>IOCTL_DISK_REASSIGN_BLOCKS</code></dt>
<dd>

<p>Reassign a list of disk blocks to the disk&#39;s spare-block pool. <code>$opOutBuf</code> should be <code>[]</code>. <code>$pInBuf</code> should be a <code>REASSIGN_BLOCKS</code> data structure:</p>

<pre><code>$pInBuf= pack( &quot;S S L*&quot;, 0, $cBlocks, @uBlockNumbers );</code></pre>

</dd>
<dt id="IOCTL_DISK_PERFORMANCE"><a class="permalink" href="./Win32API::File.html#IOCTL_DISK_PERFORMANCE">#</a><code>IOCTL_DISK_PERFORMANCE</code></dt>
<dd>

<p>Request information about disk performance. <code>$pInBuf</code> should be <code>[]</code>. <code>$opOutBuf</code> will be set to contain a <code>DISK_PERFORMANCE</code> data structure:</p>

<pre><code>    my( $ucBytesReadLow, $ivcBytesReadHigh,
	$ucBytesWrittenLow, $ivcBytesWrittenHigh,
	$uReadTimeLow, $ivReadTimeHigh,
	$uWriteTimeLow, $ivWriteTimeHigh,
	$ucReads, $ucWrites, $uQueueDepth )=
	unpack( &quot;L l L l L l L l L L L&quot;, $opOutBuf );</code></pre>

</dd>
<dt id="IOCTL_DISK_IS_WRITABLE"><a class="permalink" href="./Win32API::File.html#IOCTL_DISK_IS_WRITABLE">#</a><code>IOCTL_DISK_IS_WRITABLE</code></dt>
<dd>

<p>No documentation on this IOCTL operation was found.</p>

</dd>
<dt id="IOCTL_DISK_LOGGING"><a class="permalink" href="./Win32API::File.html#IOCTL_DISK_LOGGING">#</a><code>IOCTL_DISK_LOGGING</code></dt>
<dd>

<p>Control disk logging. Little documentation for this IOCTL operation was found. It makes use of a <code>DISK_LOGGING</code> data structure:</p>

<dl>

<dt id="DISK_LOGGING_START"><a class="permalink" href="./Win32API::File.html#DISK_LOGGING_START">#</a>DISK_LOGGING_START</dt>
<dd>

<p>Start logging each disk request in a buffer internal to the disk device driver of size <code>$uLogBufferSize</code>:</p>

<pre><code>$pInBuf= pack( &quot;C L L&quot;, 0, 0, $uLogBufferSize );</code></pre>

</dd>
<dt id="DISK_LOGGING_STOP"><a class="permalink" href="./Win32API::File.html#DISK_LOGGING_STOP">#</a>DISK_LOGGING_STOP</dt>
<dd>

<p>Stop logging each disk request:</p>

<pre><code>$pInBuf= pack( &quot;C L L&quot;, 1, 0, 0 );</code></pre>

</dd>
<dt id="DISK_LOGGING_DUMP"><a class="permalink" href="./Win32API::File.html#DISK_LOGGING_DUMP">#</a>DISK_LOGGING_DUMP</dt>
<dd>

<p>Copy the internal log into the supplied buffer:</p>

<pre><code>$pLogBuffer= &#39; &#39; x $uLogBufferSize
$pInBuf= pack( &quot;C P L&quot;, 2, $pLogBuffer, $uLogBufferSize );

( $uByteOffsetLow[$i], $ivByteOffsetHigh[$i],
  $uStartTimeLow[$i], $ivStartTimeHigh[$i],
  $uEndTimeLog[$i], $ivEndTimeHigh[$i],
  $hVirtualAddress[$i], $ucBytes[$i],
  $uDeviceNumber[$i], $bWasReading[$i] )=
  unpack( &quot;x&quot;.(8+8+8+4+4+1+1+2).&quot; L l L l L l L L C c x2&quot;, $pLogBuffer );</code></pre>

</dd>
<dt id="DISK_LOGGING_BINNING"><a class="permalink" href="./Win32API::File.html#DISK_LOGGING_BINNING">#</a>DISK_LOGGING_BINNING</dt>
<dd>

<p>Keep statics grouped into bins based on request sizes.</p>

<pre><code>$pInBuf= pack( &quot;C P L&quot;, 3, $pUnknown, $uUnknownSize );</code></pre>

</dd>
</dl>

</dd>
<dt id="IOCTL_DISK_FORMAT_TRACKS_EX"><a class="permalink" href="./Win32API::File.html#IOCTL_DISK_FORMAT_TRACKS_EX">#</a><code>IOCTL_DISK_FORMAT_TRACKS_EX</code></dt>
<dd>

<p>No documentation on this IOCTL is included.</p>

</dd>
<dt id="IOCTL_DISK_HISTOGRAM_STRUCTURE"><a class="permalink" href="./Win32API::File.html#IOCTL_DISK_HISTOGRAM_STRUCTURE">#</a><code>IOCTL_DISK_HISTOGRAM_STRUCTURE</code></dt>
<dd>

<p>No documentation on this IOCTL is included.</p>

</dd>
<dt id="IOCTL_DISK_HISTOGRAM_DATA"><a class="permalink" href="./Win32API::File.html#IOCTL_DISK_HISTOGRAM_DATA">#</a><code>IOCTL_DISK_HISTOGRAM_DATA</code></dt>
<dd>

<p>No documentation on this IOCTL is included.</p>

</dd>
<dt id="IOCTL_DISK_HISTOGRAM_RESET"><a class="permalink" href="./Win32API::File.html#IOCTL_DISK_HISTOGRAM_RESET">#</a><code>IOCTL_DISK_HISTOGRAM_RESET</code></dt>
<dd>

<p>No documentation on this IOCTL is included.</p>

</dd>
<dt id="IOCTL_DISK_REQUEST_STRUCTURE"><a class="permalink" href="./Win32API::File.html#IOCTL_DISK_REQUEST_STRUCTURE">#</a><code>IOCTL_DISK_REQUEST_STRUCTURE</code></dt>
<dd>

<p>No documentation on this IOCTL operation was found.</p>

</dd>
<dt id="IOCTL_DISK_REQUEST_DATA"><a class="permalink" href="./Win32API::File.html#IOCTL_DISK_REQUEST_DATA">#</a><code>IOCTL_DISK_REQUEST_DATA</code></dt>
<dd>

<p>No documentation on this IOCTL operation was found.</p>

</dd>
</dl>

</dd>
<dt id="&quot;:FSCTL_&quot;"><a class="permalink" href="./Win32API::File.html#%22:FSCTL_%22">#</a><a id="FSCTL_"></a><code>&quot;:FSCTL_&quot;</code></dt>
<dd>

<p>File system control operations. Used in the <code>$uIoControlCode</code> argument to <code>DeviceIoControl</code>.</p>

<p>Includes <code>FSCTL_SET_REPARSE_POINT</code>, <code>FSCTL_GET_REPARSE_POINT</code>, <code>FSCTL_DELETE_REPARSE_POINT</code>.</p>

<dl>

<dt id="FSCTL_SET_REPARSE_POINT"><a class="permalink" href="./Win32API::File.html#FSCTL_SET_REPARSE_POINT">#</a><code>FSCTL_SET_REPARSE_POINT</code></dt>
<dd>

<p>Sets reparse point data to be associated with $hDevice.</p>

</dd>
<dt id="FSCTL_GET_REPARSE_POINT"><a class="permalink" href="./Win32API::File.html#FSCTL_GET_REPARSE_POINT">#</a><code>FSCTL_GET_REPARSE_POINT</code></dt>
<dd>

<p>Retrieves the reparse point data associated with $hDevice.</p>

</dd>
<dt id="FSCTL_DELETE_REPARSE_POINT"><a class="permalink" href="./Win32API::File.html#FSCTL_DELETE_REPARSE_POINT">#</a><code>FSCTL_DELETE_REPARSE_POINT</code></dt>
<dd>

<p>Deletes the reparse point data associated with $hDevice.</p>

</dd>
</dl>

</dd>
<dt id="&quot;:GENERIC_&quot;"><a class="permalink" href="./Win32API::File.html#%22:GENERIC_%22">#</a><a id="GENERIC_"></a><code>&quot;:GENERIC_&quot;</code></dt>
<dd>

<p>Constants specifying generic access permissions that are not specific to one type of object.</p>

<pre><code class="plaintext">GENERIC_ALL			GENERIC_EXECUTE
GENERIC_READ		GENERIC_WRITE</code></pre>

</dd>
<dt id="&quot;:MEDIA_TYPE&quot;"><a class="permalink" href="./Win32API::File.html#%22:MEDIA_TYPE%22">#</a><a id="MEDIA_TYPE"></a><code>&quot;:MEDIA_TYPE&quot;</code></dt>
<dd>

<p>Different classes of media that a device can support. Used in the <code>$uMediaType</code> field of a <code>DISK_GEOMETRY</code> structure.</p>

<dl>

<dt id="Unknown"><a class="permalink" href="./Win32API::File.html#Unknown">#</a><code>Unknown</code></dt>
<dd>

<p>Format is unknown.</p>

</dd>
<dt id="F5_1Pt2_512"><a class="permalink" href="./Win32API::File.html#F5_1Pt2_512">#</a><code>F5_1Pt2_512</code></dt>
<dd>

<p>5.25&quot; floppy, 1.2MB [really 1,200KB] total space, 512 bytes/sector.</p>

</dd>
<dt id="F3_1Pt44_512"><a class="permalink" href="./Win32API::File.html#F3_1Pt44_512">#</a><code>F3_1Pt44_512</code></dt>
<dd>

<p>3.5&quot; floppy, 1.44MB [really 1,440KB] total space, 512 bytes/sector.</p>

</dd>
<dt id="F3_2Pt88_512"><a class="permalink" href="./Win32API::File.html#F3_2Pt88_512">#</a><code>F3_2Pt88_512</code></dt>
<dd>

<p>3.5&quot; floppy, 2.88MB [really 2,880KB] total space, 512 bytes/sector.</p>

</dd>
<dt id="F3_20Pt8_512"><a class="permalink" href="./Win32API::File.html#F3_20Pt8_512">#</a><code>F3_20Pt8_512</code></dt>
<dd>

<p>3.5&quot; floppy, 20.8MB total space, 512 bytes/sector.</p>

</dd>
<dt id="F3_720_512"><a class="permalink" href="./Win32API::File.html#F3_720_512">#</a><code>F3_720_512</code></dt>
<dd>

<p>3.5&quot; floppy, 720KB total space, 512 bytes/sector.</p>

</dd>
<dt id="F5_360_512"><a class="permalink" href="./Win32API::File.html#F5_360_512">#</a><code>F5_360_512</code></dt>
<dd>

<p>5.25&quot; floppy, 360KB total space, 512 bytes/sector.</p>

</dd>
<dt id="F5_320_512"><a class="permalink" href="./Win32API::File.html#F5_320_512">#</a><code>F5_320_512</code></dt>
<dd>

<p>5.25&quot; floppy, 320KB total space, 512 bytes/sector.</p>

</dd>
<dt id="F5_320_1024"><a class="permalink" href="./Win32API::File.html#F5_320_1024">#</a><code>F5_320_1024</code></dt>
<dd>

<p>5.25&quot; floppy, 320KB total space, 1024 bytes/sector.</p>

</dd>
<dt id="F5_180_512"><a class="permalink" href="./Win32API::File.html#F5_180_512">#</a><code>F5_180_512</code></dt>
<dd>

<p>5.25&quot; floppy, 180KB total space, 512 bytes/sector.</p>

</dd>
<dt id="F5_160_512"><a class="permalink" href="./Win32API::File.html#F5_160_512">#</a><code>F5_160_512</code></dt>
<dd>

<p>5.25&quot; floppy, 160KB total space, 512 bytes/sector.</p>

</dd>
<dt id="RemovableMedia"><a class="permalink" href="./Win32API::File.html#RemovableMedia">#</a><code>RemovableMedia</code></dt>
<dd>

<p>Some type of removable media other than a floppy diskette.</p>

</dd>
<dt id="FixedMedia"><a class="permalink" href="./Win32API::File.html#FixedMedia">#</a><code>FixedMedia</code></dt>
<dd>

<p>A fixed hard disk.</p>

</dd>
<dt id="F3_120M_512"><a class="permalink" href="./Win32API::File.html#F3_120M_512">#</a><code>F3_120M_512</code></dt>
<dd>

<p>3.5&quot; floppy, 120MB total space.</p>

</dd>
</dl>

</dd>
<dt id="&quot;:MOVEFILE_&quot;"><a class="permalink" href="./Win32API::File.html#%22:MOVEFILE_%22">#</a><a id="MOVEFILE_"></a><code>&quot;:MOVEFILE_&quot;</code></dt>
<dd>

<p>Constants for use in <code>$uFlags</code> arguments to <code>MoveFileEx</code>.</p>

<pre><code class="plaintext">MOVEFILE_COPY_ALLOWED		MOVEFILE_DELAY_UNTIL_REBOOT
MOVEFILE_REPLACE_EXISTING	MOVEFILE_WRITE_THROUGH</code></pre>

</dd>
<dt id="&quot;:SECURITY_&quot;"><a class="permalink" href="./Win32API::File.html#%22:SECURITY_%22">#</a><a id="SECURITY_"></a><code>&quot;:SECURITY_&quot;</code></dt>
<dd>

<p>Security quality of service values that can be used in the <code>$uFlags</code> argument to <code>CreateFile</code> if opening the client side of a named pipe.</p>

<pre><code class="plaintext">SECURITY_ANONYMOUS		SECURITY_CONTEXT_TRACKING
SECURITY_DELEGATION		SECURITY_EFFECTIVE_ONLY
SECURITY_IDENTIFICATION		SECURITY_IMPERSONATION
SECURITY_SQOS_PRESENT</code></pre>

</dd>
<dt id="&quot;:SEM_&quot;"><a class="permalink" href="./Win32API::File.html#%22:SEM_%22">#</a><a id="SEM_"></a><code>&quot;:SEM_&quot;</code></dt>
<dd>

<p>Constants to be used with <code>SetErrorMode</code>.</p>

<pre><code class="plaintext">SEM_FAILCRITICALERRORS		SEM_NOGPFAULTERRORBOX
SEM_NOALIGNMENTFAULTEXCEPT	SEM_NOOPENFILEERRORBOX</code></pre>

</dd>
<dt id="&quot;:PARTITION_&quot;"><a class="permalink" href="./Win32API::File.html#%22:PARTITION_%22">#</a><a id="PARTITION_"></a><code>&quot;:PARTITION_&quot;</code></dt>
<dd>

<p>Constants describing partition types.</p>

<pre><code class="plaintext">PARTITION_ENTRY_UNUSED		PARTITION_FAT_12
PARTITION_XENIX_1		PARTITION_XENIX_2
PARTITION_FAT_16		PARTITION_EXTENDED
PARTITION_HUGE			PARTITION_IFS
PARTITION_FAT32			PARTITION_FAT32_XINT13
PARTITION_XINT13		PARTITION_XINT13_EXTENDED
PARTITION_PREP			PARTITION_UNIX
VALID_NTFT			PARTITION_NTFT</code></pre>

</dd>
<dt id="&quot;:STD_HANDLE_&quot;"><a class="permalink" href="./Win32API::File.html#%22:STD_HANDLE_%22">#</a><a id="STD_HANDLE_"></a><code>&quot;:STD_HANDLE_&quot;</code></dt>
<dd>

<p>Constants for GetStdHandle and SetStdHandle</p>

<pre><code class="plaintext">STD_ERROR_HANDLE
STD_INPUT_HANDLE
STD_OUTPUT_HANDLE</code></pre>

</dd>
<dt id="&quot;:ALL&quot;"><a class="permalink" href="./Win32API::File.html#%22:ALL%22">#</a><a id="ALL"></a><code>&quot;:ALL&quot;</code></dt>
<dd>

<p>All of the above.</p>

</dd>
</dl>

<h1 id="BUGS"><a class="permalink" href="./Win32API::File.html#BUGS">#</a>BUGS</h1>

<p>None known at this time.</p>

<h1 id="AUTHOR"><a class="permalink" href="./Win32API::File.html#AUTHOR">#</a>AUTHOR</h1>

<p>Tye McQueen, tye@metronet.com, http://perlmonks.org/?node=tye.</p>

<h1 id="SEE-ALSO"><a class="permalink" href="./Win32API::File.html#SEE-ALSO">#</a><a id="SEE"></a>SEE ALSO</h1>

<p>The pyramids.</p>


      </div>
      <div id="footer">
        <p>Perldoc Browser is maintained by Dan Book (<a href="https://metacpan.org/author/DBOOK">DBOOK</a>). Please contact him via the <a href="https://github.com/Grinnz/perldoc-browser/issues">GitHub issue tracker</a> or <a href="mailto:dbook@cpan.org">email</a> regarding any issues with the site itself, search, or rendering of documentation.</p>

<p>The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via the <a href="https://github.com/Perl/perl5/issues">Perl issue tracker</a>, the <a href="https://lists.perl.org/list/perl5-porters.html">mailing list</a>, or <a href="https://kiwiirc.com/client/irc.perl.org/p5p">IRC</a> to report any issues with the contents or format of the documentation.</p>


      </div>
    </div>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.slim.min.js" integrity="sha512-/DXTXr6nQodMUiq+IUJYCt2PPOUjrHJ9wFrqpJ3XkgPNOZVfMok7cRw6CSxyCQxXn6ozlESsSh1/sMCTF1rL/g==" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.1/umd/popper.min.js" integrity="sha512-ubuT8Z88WxezgSqf3RLuNi5lmjstiJcyezx34yIU2gAHonIi27Na7atqzUZCOoY4CExaoFumzOsFQ2Ch+I/HCw==" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
    <script src="../highlight.pack.js"></script>
    <script>hljs.highlightAll();</script>
  </body>
</html>
